#include <bits/stdc++.h> using namespace std; int n; int a, b, s, g, t; int main() { cin >> n; for(int i = 1; i <= n; i++){ cin >> a; t = a; while(t){ t /= 10; ++g; } while(t){ b = t % 10; s += pow(b, g); t /= 10; } if(s == t){ cout << 'T' << '\n'; } else if(s != t){ cout << 'F' << '\n'; } g = 0; s = 0; } return 0;
#include <bits/stdc++.h>
using namespace std;
int n;
int a, b, s, g, t;
int main()
{
cin >> n;
for(int i = 1; i <= n; i++){
cin >> a;
t = a;
while(t){
t /= 10;
++g;
}
while(t){
b = t % 10;
s += pow(b, g);
t /= 10;
}
if(s == t){
cout << 'T' << '\n';
}
else if(s != t){
cout << 'F' << '\n';
}
g = 0;
s = 0;
}
return 0;
}