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

void solve(){
    int x;
    cin >> x;
    int r = x%11;
    if(x < 111){
        if(r <= 0){
            cout << "YES" << endl;
        }
        else{
            cout << "NO" << endl;
        }
    }
    else if(x < 222){
        if(r <= 1){
            cout << "YES" << endl;
        }
        else{
            cout << "NO" << endl;
        }
    }
    else if(x < 333){
        if(r <= 2){
            cout << "YES" << endl;
        }
        else{
            cout << "NO" << endl;
        }
    }
    else if(x < 444){
        if(r <= 3){
            cout << "YES" << endl;
        }
        else{
            cout << "NO" << endl;
        }
    }
    else if(x < 555){
        if(r <= 4){
            cout << "YES" << endl;
        }
        else{
            cout << "NO" << endl;
        }
    }
    else if(x < 666){
        if(r <= 5){
            cout << "YES" << endl;
        }
        else{
            cout << "NO" << endl;
        }
    }
    else if(x < 777){
        if(r <= 6){
            cout << "YES" << endl;
        }
        else{
            cout << "NO" << endl;
        }
    }
    else if(x < 888){
        if(r <= 7){
            cout << "YES" << endl;
        }
        else{
            cout << "NO" << endl;
        }
    }
    else if(x < 999){
        if(r <= 8){
            cout << "YES" << endl;
        }
        else{
            cout << "NO" << endl;
        }
    }
    else if(x < 1100){
        if(r <= 9){
            cout << "YES" << endl;
        }
        else{
            cout << "NO" << endl;
        }
    }
    else{
        // if x >= 1100
        // for any remainder it is possible
        cout << "YES" << endl;
    }
}

int main()
{
    int t;
    cin >> t;
    while(t--){
        solve();
    }
    return 0;
}
