#include<bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define endl "\n"
const ll mod = 1e9+7;
#define fi first
#define ss second
using ii = pair<ll,ll>;
#define pb push_back
#define mp make_pair

ll power(ll x,ll y){ll res = 1;while(y){if(y&1) res = (res*x)%mod;y=y/2,x=(x*x)%mod;}return res%mod;}
ll fact[1000001];
ll inv[1000001];
void factorial()
{
 ll i;
 fact[0] = 1;
 inv[0] = power(fact[0],mod-2);
 for(i=1;i<=1000000;i++)
 {
 fact[i] = (i*fact[i-1])%mod;
 inv[i] = power(fact[i],mod-2);
 }
}
ll ncr(ll x,ll y)
{
 if(x<y or x<0 or y<0)
 return 0;
 ll temp = fact[x];
 temp = (temp*inv[y])%mod;
 temp = (temp*inv[x-y])%mod;
 return temp;
}


void solve()
{
   
    ll n;cin>>n;

    if(n%11==0)
    {
        cout<<"YES\n";return;
    }
    else
    {
        ll k=(n%11);
        ll f=0;
        for(ll a=0;a<=k;a++)
        {
            for(ll b=0;b<=k;b++)
            {
                for(ll c=0;c<=k;c++)
                {
                    for(ll d=0;d<=k;d++)
                    {
                        if((a*111)+(b*11111)+(c*1111111)+(d*111111111)<=n)
                        {
                            if((a*111)+(b*11111)+(c*1111111)+(d*111111111)==n or (n- ((a*111)+(b*11111)+(c*1111111)+(d*111111111)))%11==0)
                            {
                                cout<<"YES\n";f=1;return;
                            }
                        }
                    }
                    
                    
                    
                }
            }
        }
        if(!f)
        cout<<"NO\n";
    }






}
signed main()
{
    IOS
    int t;cin>>t;
    while(t--)
    {
        solve();
    }
}