public static void main(String[] args) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String line = "";
		StringBuilder out = new StringBuilder();
		functionDFS();
		while ((line = in.readLine()) != null && line.length() != 0) {
			String cube = line.trim();
			int[] order = new int[] { 0, 2, 3, 5, 4, 1 }; 
			char[] d1 = new char[6], d2 = new char[6];
			for (int j = 0; j < d1.length; j++)
				d1[order[j]] = cube.charAt(j);
			for (int j = 0; j < d2.length; j++)
				d2[order[j]] = cube.charAt(j + 6);
			boolean ok = false;
			for (int j = 0; j < l.size() && !ok; j++) {
				order = l.get(j);
				ok = true;
				for (int k = 0; k < d1.length; k++) {
					if (d1[order[k]] != d2[k]) {
						ok = false;
						break;
					}
				}
			}
			out.append((ok ? "TRUE" : "FALSE") + "\n");
		}
		System.out.print(out);
	}