# include <bits/stdc++.h>
using namespace std;

# define fori(i,n)          for(int i=0;i<n;i++)
# define forl(i,n)          for (ll i=0;i<n;i++)
# define pb                 push_back
# define X                  first
# define Y                  second
# define all(v)             v.begin(),v.end()
# define in_ar_int(arr,n)   int arr[n]; fori(i,n) cin >> arr[i];
# define in_ar_ll(arr,n)    ll arr[n]; fori(i,n) cin >> arr[i];
# define endl               "\n"
# define mod                1000000007
# define pi                 3.1415926536
# define intn               int n;cin>>n
# define MOD                1000000007
# define deb(x)             cout << #x << " = " << x << endl;
# define deb2(a,b)          cout << #a << " = " << a << " and " << #b << " is " << b << endl;

typedef long long ll;
//gcd(a,b) = gcd(a,b-a)

void solve(){
    ll n; cin>>n;
    ll cc = n / 11;
    ll cc1 = n % 11;
    if(cc >= cc1 * 10) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
}     

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    int chill=1;
    cin >> chill;
    while(chill--){
        solve();
    }
}