#include using namespace std; #define rep(i,n) for(int i=0;i<(int)(n);i++) #define rrep(i,n) for(int i=(int)(n-1);i>=0;i--) #define ALL(v) v.begin(),v.end() #define RALL(v) v.rbegin(),v.rend() template using V=vector; template using VV=V>; using u128=__int128_t; using ll=long long; const ll M=888888888888888888; int f(ll x){ ll ma=0; while(x){ ma=max(ma,x%10); x/=10; } return ma; } int main(){ ios::sync_with_stdio(false); std::cin.tie(nullptr); V L(100,-1),R(100,-1); for(int i=1;i<100;i++){ for(int j=i;j<100;j++){ int sum=0; for(int k=i;k<=j;k++) sum+=f(k); if(sum<100 && L[sum]==-1) L[sum]=i,R[sum]=j; } } int t; cin>>t; while(t--){ ll n; cin>>n; if(n<100) cout<