It can be seen that the number, 125874, and its double, 251748, contain exactly the same digits, but in a different order. 
WAP to check that if 2 such numbers have this property

Input:
The first line will consist of the total number of test cases T(1 ≤ T ≤ 10). 
The next T lines will consist of one number on each line. This is the number N(1 ≤ N ≤ 100000000).

Output:
For each test case, output a single line which returns 1 if the 2 numbers satisfy the above said conditions and 0 otherwise
Example:
Input:
5
23
45
123
123
1234
123
1223
1222
1223
1234
Output:
0
1
0
0
0
import sys
t = int(input())
while t>0:
    a = sys.stdin.readline()
    b = sys.stdin.readline()
    if len(a)!=len(b):
        print ("0")
    else:
        x=0
        while x!=len(a):
            check=1
            y=0
            while y!=len(b):
                if a[x]==b[y]:
                    b=b[:y]+"a"+b[y+1:]
                    check=0
                    break
                y+=1
            if check==1:
                print ("0")
                break
            x+=1
        if check==0:
            print ("1")
    t-=1