Under construction

Still being built. Things may change

Number Reversal

Interview

Time limit1sMemory limit128 MB

Summary
For each number, reverse its digits, add to the original, and print YES if the sum is a palindrome, else NO.
Level

Easy2 of 10

Topics
String, Math, Implementation
Solved
No attempts yet

Problem

For each test case, an integer N is given. Let R be the number made by reading the decimal digits of N in reverse order.

Determine whether N + R is a palindrome, meaning it reads the same from left to right and from right to left. Any leading zeros that appear after reversing are discarded when R is interpreted as an integer.

Input

The first line contains the number of test cases T. Each of the next T lines contains one integer N.

  • 10 <= N <= 100000

Output

For each test case, print YES if the sum of the original number and its reversed number is a palindrome. Otherwise, print NO.

Examples1

  1. Example 1

    Input
    4
    13
    58
    120
    5056
    
    Expected output
    YES
    NO
    YES
    NO