#include #include #include #include using namespace std; const int maxn = 1e7+5; void add(char a[],char b[],char back[]) { int i,j,k,up,x,y,z,l; char *c; if (strlen(a)>strlen(b)) l=strlen(a)+2; else l=strlen(b)+2; c=(char *) malloc(l*sizeof(char)); i=strlen(a)-1; j=strlen(b)-1; k=0;up=0; while(i>=0||j>=0) { if(i<0) x='0'; else x=a[i]; if(j<0) y='0'; else y=b[j]; z=x-'0'+y-'0'; if(up) z+=1; if(z>9) {up=1;z%=10;} else up=0; c[k++]=z+'0'; i--;j--; } if(up) c[k++]='1'; i=0; c[k]='\0'; for(k-=1;k>=0;k--) back[i++]=c[k]; back[i]='\0'; } char s[maxn]; char b[10]; char c[maxn]; bool cmp(char a,char b) { return a>b; } int main() { int t; scanf("%d",&t); while(t--) { scanf("%s",s); int len = strlen(s); int count = 0; for(int i = 0; i'0'&&s[i]<='9') { count++; } } if(count == 1) { printf("Uncertain\n"); } else { memset(b,0,sizeof(b)); sort(s,s+len,cmp); for(int i = len-1; i>=0; i--) { if(s[i]!='0') { b[0] = s[i]; for(int j = i; j