You are given an integer x. Can you make x by summing up some number of 11, 111, 1111, 11111, …? (You can use any number among them any number of times).

For instance, 

  * 33=11+11+11 
  * 144=111+11+11+11 

Input

The first line of input contains a single integer t (1 ≤ t ≤ 10000) — the number of testcases.

The first and only line of each testcase contains a single integer x (1 ≤ x ≤ 10^9) — the number you have to make.

Output

For each testcase, you should output a single string. If you can make x, output "YES" (without quotes). Otherwise, output "NO".

You can print each letter of "YES" and "NO" in any case (upper or lower).

Example

Input


3
33
144
69


Output


YES
YES
NO

Note

Ways to make 33 and 144 were presented in the statement. It can be proved that we can't present 69 this way.


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.PriorityQueue;
import java.util.StringTokenizer;
import java.util.TreeMap;




public class CodeForcesB {
	static HashMap<String,Integer> hm;
	static class FastReader 
    { 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastReader() 
        { 
            br = new BufferedReader(new
                     InputStreamReader(System.in)); 
        } 
  
        String next() 
        { 
            while (st == null || !st.hasMoreElements()) 
            { 
                try
                { 
                    st = new StringTokenizer(br.readLine()); 
                } 
                catch (IOException  e) 
                { 
                    e.printStackTrace(); 
                } 
            } 
            return st.nextToken(); 
        } 
  
        int nextInt() 
        { 
            return Integer.parseInt(next()); 
        } 
  
        long nextLong() 
        { 
            return Long.parseLong(next()); 
        } 
  
        double nextDouble() 
        { 
            return Double.parseDouble(next()); 
        } 
  
        String nextLine() 
        { 
            String str = ""; 
            try
            { 
                str = br.readLine(); 
            } 
            catch (IOException e) 
            { 
                e.printStackTrace(); 
            } 
            return str; 
        }
        int[] nextArray(int n)
        {
        	int arr[]=new int[n];
        	for(int i=0;i<n;i++)
        		arr[i]=nextInt();
        	return arr;
        }
    }
	static boolean palin(char[] arr)
	{
		if(arr.length==1)
			return false;
		for(int i=0;i<arr.length/2;i++)
			if(arr[i]!=arr[arr.length-1-i])
				return false;
		return true;
	}
	static long gcd(long a,long b)
    {
        // Everything divides 0 
        if (a == 0)
          return b;
        if (b == 0)
          return a;
      
        // base case
        if (a == b)
            return a;
      
        // a is greater
        if (a > b)
            return gcd(a-b, b);
        return gcd(a, b-a);
    }
	static boolean palin(String all)
	{
		for(int i=0;i<all.length()-1;i++)
		{
			for(int j=0;j<=i;j++)
			{
				if(palin(all.substring(j,all.length()-i+j).toCharArray()))
					return true;
			}
		}
		return false;
	}
	static void helper(int n,int[] arr,StringBuilder sb)
	{
		int max=0;
		for(int i=1;i<n;i++)
		{
			if(arr[i]-arr[max]>0)
				max=i;
		}
		for(int i=max;i<n;i++)
			sb.append(arr[i]+" ");
		if(max>0)
		helper(max, arr, sb);
		
	}
	static boolean helper(String text,String ans,HashSet<String> hs)
	{
		if(text.equals(ans))
			return true;
		if(hs.contains(text))
			return false;
		hs.add(text);
		int c=0,c2=0;
		char[] arr=text.toCharArray();
		StringBuilder sb=new StringBuilder();
		for(int i=0;i<arr.length;i++)
			
		{
			char ch=arr[i];
			if(ch=='1')
			{
				c++;
				sb.append(0);
			}
			else {
				c--;
				sb.append(1);
			}
			if(arr[i]!=ans.charAt(i))
				c2++;
			if(c==0&&c2%2==0)
			{
				if(i==arr.length-1)
				{
					if(helper(sb.toString(), ans, hs))
						return true;
				}
				else {
					if(helper(sb.toString()+text.substring(i+1), ans, hs))
						return true;
				}
			
			}
				
		}
		return false;
	}
	static boolean helper(String text,String ans,int i,HashSet<String> hs,PriorityQueue<Integer> pq)
	{
		if(ans.equals(text))
			return true;
		if(hs.contains(text)||i==-1)
			return false;
		int curr=pq.remove();
		String change=text.substring(0,curr+1);
		int num=Integer.parseInt(change,2);
		String changed=(~num)+"";
		int prev=-1;
		if(!pq.isEmpty())
			prev=pq.peek();
		return helper(changed+text.substring(i+1), ans,prev, hs,pq)||helper(text, ans,prev, hs,pq);
	}
	public static <K, V extends Comparable<V> > TreeMap<K, V>
    valueSort( Map<K, V> map)
    {
        // Static Method with return type Map and
        // extending comparator class which compares values
        // associated with two keys
        Comparator<K> valueComparator = new Comparator<K>()
        {
              
            public int compare(K k1, K k2)
            {
  
                int comp = map.get(k1).compareTo(map.get(k2));
  
                if (comp >= 0)
                     return 0;
  
                else
                     return comp;
            }
        };
        System.out.println(map);
        TreeMap<K, V> sorted = new TreeMap<K, V>(valueComparator);
        
        sorted.putAll(map);
  
        return sorted;
    }
	public static HashMap<Integer, Integer> sortByValue(HashMap<Integer, Integer> hm)
    {
        // Create a list from elements of HashMap
        List<Entry<Integer, Integer>> list =
               new LinkedList<Map.Entry<Integer, Integer> >(hm.entrySet());
  
        // Sort the list
        Collections.sort(list, new Comparator<Map.Entry<Integer, Integer> >() {
        	public int compare(Map.Entry<Integer, Integer> o1, 
                               Map.Entry<Integer, Integer> o2)
            {
                if (o1.getValue()==o2.getValue())
                	return o1.getKey()-o2.getKey();
                return -o1.getValue()+o2.getValue();
                
            }
        });
          
        // put data from sorted list to hashmap 
        HashMap<Integer, Integer> temp = new LinkedHashMap<Integer, Integer>();
        for (Map.Entry<Integer, Integer> aa : list) {
            temp.put(aa.getKey(), aa.getValue());
        }
        return temp;
    }
	static boolean helper(int[] arr,int i,StringBuilder sb,StringBuilder sb2,HashSet<String> hs,List<Integer> list)
	{
//		System.out.println(sb2);
		if(i==arr.length)
			return true;
		String key=sb.toString()+","+i;
//		System.out.println(key);
		if(hs.contains(key))
			return false;
		hs.add(key);
		if(sb.length()==0&&i!=0)
			return false;
		if(sb2.length()==0)
		{
			sb.append(1);
			list.add(1);
			sb2.append(1);
			return helper(arr, i+1, sb,sb2, hs,list);
		}
//		sb.append("\n");
		if(arr[i]==1)
		{
			sb2.append(".1");
//			System.out.println(sb2);
			list.add(1);
			if(helper(arr, i+1, sb,new StringBuilder(sb2), hs, list))
			{
				sb.insert(0,sb2.toString()+"\n");
				return true;
			}
			sb2.delete(0, sb2.length()-2);
			list.remove(list.size()-1);
		}
		for(int j=list.size()-1;j>=0;j--)
		{
			if(list.get(j)==arr[i]-1)
			{
//				System.out.println(j);
//				System.out.println(sb2);
//				sb2.delete(2*j, sb2.length());
				sb2.delete( sb2.length()-(int)Math.log10(list.get(j))-1,sb2.length());
				sb2.append(arr[i]);
				list.remove((int)j);
				list.add(arr[i]);
				if(helper(arr, i+1, sb, new StringBuilder(sb2), hs, list))
				{
					sb.insert(0,sb2.toString()+"\n");
//					sb2.delete(0, sb2.length()-2);
					return true;
				}
				list.remove((int)j);
				
			}
			else {
				if(j>0)
				sb2.delete( sb2.length()-(int)Math.log10(list.get(j))-2,sb2.length());
				else {
					sb2.delete( sb2.length()-(int)Math.log10(list.get(j))-1,sb2.length());
				}
				list.remove((int)j);
			}
		}
		return false;
	}
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		
			FastReader fs=new FastReader();
			PrintWriter out=new PrintWriter(System.out);
			//out.print("111");
			int T=fs.nextInt();
			StringBuilder sb=new StringBuilder();
			while(T-->0)
			{
				int n=fs.nextInt();
				boolean ans=false;
				for(int i=0;i<111;i++)
				{
					int val=n-11*i;
					if(val>=0&&val%111==0)
					{
						ans=true;
						break;
					}
				}
				sb.append(ans?"YES":"NO");
				sb.append("\n");
			}
			System.out.println(sb);
			
	}

}
