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