#include<iostream>
#include<vector>
using namespace std;
int main(){
	int t;
	cin>>t;
	while(t--){
		int n;
		cin>>n;
		if(n<100){
			if((n/10)==(n%10)){
				cout<<"YES"<<endl;
			}
			else{
				cout<<"NO"<<endl;
			}
		}
		else{
			int f=0;
			while(n>=0){
				if(n%11==0){
					cout<<"YES"<<endl;
					f=1;
					break;
				}
				n-=111;
			}
			if(f==0){
				cout<<"NO"<<endl;
			}
			
		}
	}
}
