Language: Java

import java.util.*;

public class Main{
	int T, S, E, W, N, U;
	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();
		}
		T = in[0];
		S = in[1];
		E = in[2];
		W = in[3];
		N = in[4];
		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 == N){
					MoveSouth();
					MoveSouth();
				} else if(m == U){
					MoveSouth();
					MoveSouth();
					MoveSouth();
				} else if(m == T){
					MoveSouth();
				} else {
					MoveEast();
				}
				if(m == S){
					if(n == T){
						flg = true;
						break;
					} else {
						MoveEast();
					}
				}
				
			}
			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:12: error: non-static variable T cannot be referenced from a static context
		T = in[0];
		^
Main.java:13: error: non-static variable S cannot be referenced from a static context
		S = in[1];
		^
Main.java:14: error: non-static variable E cannot be referenced from a static context
		E = in[2];
		^
Main.java:15: error: non-static variable W cannot be referenced from a static context
		W = in[3];
		^
Main.java:16: error: non-static variable N cannot be referenced from a static context
		N = in[4];
		^
Main.java:17: error: non-static variable U cannot be referenced from a static context
		U = in[5];
		^
Main.java:25: error: non-static variable N cannot be referenced from a static context
				if(m == N){
				        ^
Main.java:28: error: non-static variable U cannot be referenced from a static context
				} else if(m == U){
				               ^
Main.java:32: error: non-static variable T cannot be referenced from a static context
				} else if(m == T){
				               ^
Main.java:37: error: non-static variable S cannot be referenced from a static context
				if(m == S){
				        ^
Main.java:38: error: non-static variable T cannot be referenced from a static context
					if(n == T){
					        ^
Main.java:47: error: non-static variable E cannot be referenced from a static context
			System.out.println(E);
			                   ^
Main.java:53: error: non-static variable T cannot be referenced from a static context
		int a = T;
		        ^
Main.java:54: error: non-static variable T cannot be referenced from a static context
		T = N;
		^
Main.java:54: error: non-static variable N cannot be referenced from a static context
		T = N;
		    ^
Main.java:55: error: non-static variable N cannot be referenced from a static context
		N = U;
		^
Main.java:55: error: non-static variable U cannot be referenced from a static context
		N = U;
		    ^
Main.java:56: error: non-static variable U cannot be referenced from a static context
		U = S;
		^
Main.java:56: error: non-static variable S cannot be referenced from a static context
		U = S;
		    ^
Main.java:57: error: non-static variable S cannot be referenced from a static context
		S = a;
		^
Main.java:60: error: non-static variable T cannot be referenced from a static context
		int a = T;
		        ^
Main.java:61: error: non-static variable T cannot be referenced from a static context
		T = W;
		^
Main.java:61: error: non-static variable W cannot be referenced from a static context
		T = W;
		    ^
Main.java:62: error: non-static variable W cannot be referenced from a static context
		W = U;
		^
Main.java:62: error: non-static variable U cannot be referenced from a static context
		W = U;
		    ^
Main.java:63: error: non-static variable U cannot be referenced from a static context
		U = E;
		^
Main.java:63: error: non-static variable E cannot be referenced from a static context
		U = E;
		    ^
Main.java:64: error: non-static variable E cannot be referenced from a static context
		E = a;
		^
Main.java:67: error: non-static variable T cannot be referenced from a static context
		int a = T;
		        ^
Main.java:68: error: non-static variable T cannot be referenced from a static context
		T = S;
		^
Main.java:68: error: non-static variable S cannot be referenced from a static context
		T = S;
		    ^
Main.java:69: error: non-static variable S cannot be referenced from a static context
		S = U;
		^
Main.java:69: error: non-static variable U cannot be referenced from a static context
		S = U;
		    ^
Main.java:70: error: non-static variable U cannot be referenced from a static context
		U = N;
		^
Main.java:70: error: non-static variable N cannot be referenced from a static context
		U = N;
		    ^
Main.java:71: error: non-static variable N cannot be referenced from a static context
		N = a;
		^
Main.java:74: error: non-static variable T cannot be referenced from a static context
		int a = T;
		        ^
Main.java:75: error: non-static variable T cannot be referenced from a static context
		T = E;
		^
Main.java:75: error: non-static variable E cannot be referenced from a static context
		T = E;
		    ^
Main.java:76: error: non-static variable E cannot be referenced from a static context
		E = U;
		^
Main.java:76: error: non-static variable U cannot be referenced from a static context
		E = U;
		    ^
Main.java:77: error: non-static variable U cannot be referenced from a static context
		U = W;
		^
Main.java:77: error: non-static variable W cannot be referenced from a static context
		U = W;
		    ^
Main.java:78: error: non-static variable W cannot be referenced from a static context
		W = a;
		^
44 errors