SQ2SQ2 - TSquare TO Square

There are squares whose digits can be rearranged to make another squares. Lets call them S2S numbers.

For example: 144 → 441

Input

Single line containing two integers X Y (Xth, Yth term in the list of S2S numbers).

Output

Print all the numbers from Xth to Yth term of S2S numbers (both inclusive).

Example

Input:
1 3

Output:
144
169
196

(Xth, Yth term <= 10^12)
(Source Code Limit= 1000B)
Note: 1 → 100 → 1 or other similar numbers are NOT S2S numbers (e.g. 9 → 900 → 9)

Try the classic version -> http://www.spoj.com/problems/SQ2SQ/


Added by:Avinash
Date:2012-04-12
Time limit:0.709s-1.908s
Source limit:1000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64
Resource:Own Problem

hide comments
2014-06-15 20:31:55 Saurabh Jain
Getting TLE, how to improve??
2012-04-16 17:52:40 Jared Deckard
What previously got AC now gets WA... WHY!?
2012-04-16 17:52:40 wrong answer
WTH?
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.