#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<map>
#include<stack>
#include<queue>
#include<vector>
#include <set>
#define rep(i,a,n) for(int i=a;i<=n;i++)
#define in(n) scanf("%d",&n)
#define lin(n) scanf("%lld",&n)
#define ll long long
#define N (int)20
#define MOD (int)1e9+7
using namespace std;
int main(){
    int t;in(t);
    while(t--){
        int a;in(a);
        int fl=0;
       for(int i=0;i<=a;i+=111){
           if((a-i)%11==0){fl=1;break;}
       }
       if(fl)cout<<"yes"<<endl;
       else cout<<"no"<<endl;
    }
}
   	 	 		 				 	    	     	