#include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; const int maxn = 1e7+100; char s[maxn]; int a[maxn]; int cnt, z; int main() { int T; cin>>T; while(T--){ scanf("%s",s); cnt = 0; for(int i = 0; s[i]!='\0'; i++){ if(s[i]>='1'&&s[i]<='9') cnt++; a[i] = s[i]-'0'; } if(cnt<2){ printf("Uncertain\n"); continue; } int n = strlen(s); sort(a,a+n); int pos; int ch; for(int i = 0; i < n; i++){ if(a[i]!=0){ ch = a[i]; pos = i; break; } } for(int j = pos; j < n-1; j++){ a[j] = a[j+1]; } n--; a[n] = 0; for(int i = 0; i <= n&&ch; i++){ int t = ch+a[i]; a[i] = t%10; ch = t/10; } if(a[n]==0){ for(int i = n-1; i >= 0; i--){ printf("%d",a[i]); } }else for(int i = n; i >= 0; i--){ printf("%d",a[i]); } printf("\n"); } return 0; }