#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define vi vector<ll>
#define rep(i,a,b) for(int i=a; i<b; ++i)
#define pb push_back
#define endl '\n'
#define sa(x) sort((x).begin(), (x).end());
#define int long long

template<typename T, typename U> static inline void amin(T &x, U y){ if(y<x) x=y; }
template<typename T, typename U> static inline void amax(T &x, U y){ if(x<y) x=y; }
template<typename T> static inline void sd(vector<T> &x) {sort((x).begin(), (x).end(), greater<T>()) ; }


void solve(){
	int n;
	cin>>n;
	if(n >= 1100)
	{
		cout<<"YES\n";
		return;
	}

	int m=0;
	while(111*m <= n)
	{
		int r=n-111*m;
		if(r%11 == 0)
		{
			cout<<"YES\n";
			return;
		}
		m++;
	}
	cout<<"NO\n";

}

signed main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int testcases=1;
	cin>>testcases;
	while(testcases--){
		solve();
	}
	return 0;	
}
