// Arup Guha
// 10/31/2023
// Solution to CIS 3362 Homework #6 Question #4 Part B: Use Alice's secret value to decrypt!

import java.util.*;
import java.math.BigInteger;

public class h6q4p2 {

	public static void main(String[] args) {
	
		BigInteger q = new BigInteger("208827064597");
	
		Scanner stdin = new Scanner(System.in);
		int n = stdin.nextInt();
		
		// Found from part 1.
		BigInteger a = new BigInteger("161672808561");
		
		// Do each block.
		for (int loop=0; loop<n; loop++) {
	
			// Read ciphertext.
			BigInteger c1 = new BigInteger(stdin.next());
			BigInteger c2 = new BigInteger(stdin.next());
			
			// Extract K and then K inverse mod q.
			BigInteger K = c1.modPow(a, q);
			BigInteger Kinv = K.modInverse(q);
			
			// Calculate the plaintext.
			BigInteger res = Kinv.multiply(c2);
			res = res.mod(q);
			
			// Ta da!
			System.out.println(recover(res));
		}
		
	}
	
	public static String recover(BigInteger m) {
		
		// Base we are using.
		BigInteger base = new BigInteger("26");
		
		// We know each block is 8 characters...
		char[] res = new char[8];
		
		// Peel them off...
		for (int i=7; i>=0; i--) {
			BigInteger tmp = m.mod(base);
			res[i] = (char)(tmp.intValue() + 'a');
			m = m.divide(base);
		}
		
		// Ta da!
		return new String(res);
	}
	
	
}