import java.util.Scanner;

class solution {
	public static boolean isVowel(char c) {
		return c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u' || c == 'y';
	}
	public static String piglatin(String word) {
		if (isVowel(word.charAt(0)))
			return word + "yay";
		String consonant = "";
		String rest = "";
		boolean incluster = true;
		for (int pos = 0; pos < word.length(); ++pos) {
			char c = word.charAt(pos);
			if (isVowel(c)) incluster = false;
			if (incluster) consonant = consonant + c;
			else rest = rest + c;
		}
		return rest + consonant + "ay";
	}
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int T = Integer.parseInt(sc.nextLine());
		for (int t = 0; t < T; ++t) {
			String input = sc.nextLine();
			boolean first = true;
			for (String word : input.split(" ")) {
				if (!first) System.out.print(" ");
				first = false;
				System.out.print(piglatin(word));
			}
			System.out.println();
		}
	}
}
