from functools import cache from bisect import bisect_left, bisect_right import heapq from itertools import product from itertools import permutations import random import math import bisect import sys from collections import defaultdict from itertools import combinations sys.setrecursionlimit(10**7) inf = 1 << 60 def sgn(x): if x > 0: return 1 elif x == 0: return 0 else: return -1 def popC(x): ans = 0 while x != 0: ans += x % 2 x //= 2 return ans def exit(): sys.exit() def LI(): return list(map(int, input().split())) def II(): return int(input()) def SI(): return input() n = input() x = int(n[::-1]) for i in range(x): a, b = input().split() a = int(a[::-1]) b = int(b[::-1]) print(a, b)