#include<bits/stdc++.h>
using namespace std;
int huiwen(long long n){
	if(n<10)return true;
	long long s=0,ss=n;
	while(n>0){		
		int a=n%10;
		s=s*10+a;
		n=n/10;
	}
	if(s==ss)return true;
	else return false;
}
int main(){
	int t,n;
	cin>>t;
	for(int i=0;i<t;i++){
		cin>>n;
		int maxx=0;
		for(int j=n;j>0;j--){
			for(int k=n;k>0;k--){
				if(huiwen(j*k)){
					if(maxx<j*k)
						maxx=j*k;
				}
		}
	}
	cout<<maxx<<endl;
	}
	return 0;
}

0 comments

No comments so far...