//   AUTHOR : Palukuri Revanth 
#include <bits/stdc++.h>
using namespace std;
/*  <--------- Shortcuts --------->  */
#define f(i,a,b) for(ll i=a;i<b;i++)
#define f2(i,a,b) for(ll i=a;i<b;i+=2)
#define fr(j,a,b) for(ll j=b-1;j>=a;j--)
#define vsort(a) sort(a.begin(),a.end())
#define vrsort(a) sort(a.begin(),a.end(),greater< ll >())
#define vprsort(a) sort(a.rbegin(),a.rend())
#define vll vector <ll>
#define vmll vector <vll>
#define pi pair <int,int>
#define pll pair <ll,ll>
#define vpi vector< pi >
#define vpll vector< pll >
#define si set <int>
#define spi set <pi >
#define spll set <pll >
#define sll set <ll>
#define wl while
#define e "\n"
#define spc " "
#define ll long long int
#define ull unsigned long long int
#define pb push_back
#define ins insert
#define F first
#define S second
#define all(a) a.begin(),a.end()
#define sz(a) a.size()
#define mset(a,x) memset(a,x,sizeof(a))
#define tc() int t;cin>>t;wl(t--)
#define fast ios:: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
/* <--------- IO ---------> */
     
#define get(a,n) vll a(n); f(i,0,n) cin>>a[i]
#define put(a) f(i,0,a.size()) cout<<a[i]<<spc; cout<<e
int main()
{
  tc()
  {
    ll n,temp=0;
    cin>>n;
    f(i,0,11)
    {
      ll x=n-111*i;
      if(x>=0 && x%11==0) temp=1;
    }
    if(temp==1) cout<<"YES";
    else cout<<"NO";
    cout<<e;
  }
} 