Language: Java

import java.util.*;

public class Main{
	public static void main(String[] args){

		Scanner scan = new Scanner(System.in);
		int[] in = new int[6];
		for(int i = 0; i < 6; i++){
			in[i] = scan.nextInt();
		}
		int T = in[0];
		int S = in[1];
		int E = in[2];
		int W = in[3];
		int N = in[4];
		int U = in[5];

		int q = scan.nextInt();
		for(int i = 0; i < q; i++){
			int n = scan.nextInt();
			int m = scan.nextInt();
			boolean flg = false;
			while(true){
				if(m == S){
					if(n == T){
						flg = true;
						break;
					} else{
						MoveEast();
					}
				} else{
					MoveSouth();
				}
				
			}
			System.out.println(E);
		}

	}

	public static void MoveSouth(){
		int a = T;
		T = N;
		N = U;
		U = S;
		S = a;
	}
	public static void MoveEast(){
		int a = T;
		T = W;
		W = U;
		U = E;
		E = a;
	}
	public static void MoveNorth(){
		int a = T;
		T = S;
		S = U;
		U = N;
		N = a;
	}
	public static void MoveWest(){
		int a = T;
		T = E;
		E = U;
		U = W;
		W = a;
	}
}

Compiler output:
Main.java:42: error: cannot find symbol
		int a = T;
		        ^
  symbol:   variable T
  location: class Main
Main.java:43: error: cannot find symbol
		T = N;
		^
  symbol:   variable T
  location: class Main
Main.java:43: error: cannot find symbol
		T = N;
		    ^
  symbol:   variable N
  location: class Main
Main.java:44: error: cannot find symbol
		N = U;
		^
  symbol:   variable N
  location: class Main
Main.java:44: error: cannot find symbol
		N = U;
		    ^
  symbol:   variable U
  location: class Main
Main.java:45: error: cannot find symbol
		U = S;
		^
  symbol:   variable U
  location: class Main
Main.java:45: error: cannot find symbol
		U = S;
		    ^
  symbol:   variable S
  location: class Main
Main.java:46: error: cannot find symbol
		S = a;
		^
  symbol:   variable S
  location: class Main
Main.java:49: error: cannot find symbol
		int a = T;
		        ^
  symbol:   variable T
  location: class Main
Main.java:50: error: cannot find symbol
		T = W;
		^
  symbol:   variable T
  location: class Main
Main.java:50: error: cannot find symbol
		T = W;
		    ^
  symbol:   variable W
  location: class Main
Main.java:51: error: cannot find symbol
		W = U;
		^
  symbol:   variable W
  location: class Main
Main.java:51: error: cannot find symbol
		W = U;
		    ^
  symbol:   variable U
  location: class Main
Main.java:52: error: cannot find symbol
		U = E;
		^
  symbol:   variable U
  location: class Main
Main.java:52: error: cannot find symbol
		U = E;
		    ^
  symbol:   variable E
  location: class Main
Main.java:53: error: cannot find symbol
		E = a;
		^
  symbol:   variable E
  location: class Main
Main.java:56: error: cannot find symbol
		int a = T;
		        ^
  symbol:   variable T
  location: class Main
Main.java:57: error: cannot find symbol
		T = S;
		^
  symbol:   variable T
  location: class Main
Main.java:57: error: cannot find symbol
		T = S;
		    ^
  symbol:   variable S
  location: class Main
Main.java:58: error: cannot find symbol
		S = U;
		^
  symbol:   variable S
  location: class Main
Main.java:58: error: cannot find symbol
		S = U;
		    ^
  symbol:   variable U
  location: class Main
Main.java:59: error: cannot find symbol
		U = N;
		^
  symbol:   variable U
  location: class Main
Main.java:59: error: cannot find symbol
		U = N;
		    ^
  symbol:   variable N
  location: class Main
Main.java:60: error: cannot find symbol
		N = a;
		^
  symbol:   variable N
  location: class Main
Main.java:63: error: cannot find symbol
		int a = T;
		        ^
  symbol:   variable T
  location: class Main
Main.java:64: error: cannot find symbol
		T = E;
		^
  symbol:   variable T
  location: class Main
Main.java:64: error: cannot find symbol
		T = E;
		    ^
  symbol:   variable E
  location: class Main
Main.java:65: error: cannot find symbol
		E = U;
		^
  symbol:   variable E
  location: class Main
Main.java:65: error: cannot find symbol
		E = U;
		    ^
  symbol:   variable U
  location: class Main
Main.java:66: error: cannot find symbol
		U = W;
		^
  symbol:   variable U
  location: class Main
Main.java:66: error: cannot find symbol
		U = W;
		    ^
  symbol:   variable W
  location: class Main
Main.java:67: error: cannot find symbol
		W = a;
		^
  symbol:   variable W
  location: class Main
32 errors