//Haha TTpro
//BCPALIN
//http://www.spoj.com/PTIT/problems/BCPALIN/
#include <iostream>

using namespace std;
bool doixung (int A);
int main()
{
    int A;
    int t;
    cin >>t;
    for (int i=1;i<=t;i++)
    {
   cin>>A;
   if (doixung(A)) cout<<"YES" ; else cout<<"NO";
   cout<<endl;
    }
    return 0;
}

bool doixung (int A)
{
    int a=A;
    int b=0; // so sau khi tach

    int x; // tach so
    while (a!=0)
    {
        b=b*10;
        x=a%10;
        a=a/10;
        b=b+x;
    }

    if (A==b) return true;
    return false;
}
