Language: C++

#include <iostream>
#include <vector>
using namespace std;

class Dice{
public:
	long top, front, right, left, right, back, bottom;
	Dice(long top, long front);
	void North();
	void South();
	void West();
	void East();
	long showTop();
	long guessRightFromTopAndFront(long top, long front);
};

Dice::Dice(long top, long front){
	this->top = top;
	this->front = front;
	if (top == 1){
		if (front == 2) r = 3;
		else if (front == 5) r = 4;
		else if (front == 3) r = 5;
		else if (front == 4) r = 2;
	}
	else if (top == 6){
		if (front == 2) r = 4;
		else if (front == 5) r = 3;
		else if (front == 3) r = 2;
		else if (front == 4) r = 5;
	}
	else if (top == 2){
		if (front == 1) r = 4;
		else if (front == 6) r = 3;
		else if (front == 3) r = 1;
		else if (front == 4) r = 6;
	}
	else if (top == 5){
		if (front == 1) r = 3;
		else if (front == 6) r = 4;
		else if (front == 3) r = 6;
		else if (front == 4) r = 1;
	}
	else if (top == 3){
		if (front == 1) r = 2;
		else if (front == 6) r = 5;
		else if (front == 2) r = 6;
		else if (front == 5) r = 1;
	}
	else if (top == 4){
		if (front == 1) r = 5;
		else if (front == 6) r = 2;
		else if (front == 2) r = 1;
		else if (front == 5) r = 6;
	}
	this->right = r;
	this->left = 7 - r;
	this->back = 7 - front;
	this->bottom = 7 - top;
}

void Dice::north(){
	long sv[6];
	sv[0] = this->front;
	sv[1] = this->bottom;
	sv[2] = this->right;
	sv[3] = this->left;
	sv[4] = this->top;
	sv[5] = this->back;

	this->top = sv[0];
	this->front = sv[1];
	this->right = sv[2];
	this->left = sv[3];
	this->back = sv[4];
	this->bottom = sv[5];
}

void Dice::south(){
	long sv[6];
	sv[0] = this->back;
	sv[1] = this->top;
	sv[2] = this->right;
	sv[3] = this->left;
	sv[4] = this->bottom;
	sv[5] = this->front;

	this->top = sv[0];
	this->front = sv[1];
	this->right = sv[2];
	this->left = sv[3];
	this->back = sv[4];
	this->bottom = sv[5];
}

void Dice::west(){
	long sv[6];
	sv[0] = this->right;
	sv[1] = this->front;
	sv[2] = this->bottom;
	sv[3] = this->top;
	sv[4] = this->back;
	sv[5] = this->left;

	this->top = sv[0];
	this->front = sv[1];
	this->right = sv[2];
	this->left = sv[3];
	this->back = sv[4];
	this->bottom = sv[5];
}

void Dice::east(){
	long sv[6];
	sv[0] = this->left;
	sv[1] = this->front;
	sv[2] = this->top;
	sv[3] = this->bottom;
	sv[4] = this->back;
	sv[5] = this->right;

	this->top = sv[0];
	this->front = sv[1];
	this->right = sv[2];
	this->left = sv[3];
	this->back = sv[4];
	this->bottom = sv[5];
}

void Dice::showTop(){
	cout << this->top << endl;
}

long guessRightFromTopAndFront(long top, long front){
	if (top == 1){
		if (front == 2) return 3;
		else if (front == 5) return 4;
		else if (front == 3) return 5;
		else if (front == 4) return 2;
	}
	else if (top == 6){
		if (front == 2) return 4;
		else if (front == 5) return 3;
		else if (front == 3) return 2;
		else if (front == 4) return 5;
	}
	else if (top == 2){
		if (front == 1) return 4;
		else if (front == 6) return 3;
		else if (front == 3) return 1;
		else if (front == 4) return 6;
	}
	else if (top == 5){
		if (front == 1) return 3;
		else if (front == 6) return 4;
		else if (front == 3) return 6;
		else if (front == 4) return 1;
	}
	else if (top == 3){
		if (front == 1) return 2;
		else if (front == 6) return 5;
		else if (front == 2) return 6;
		else if (front == 5) return 1;
	}
	else if (top == 4){
		if (front == 1) return 5;
		else if (front == 6) return 2;
		else if (front == 2) return 1;
		else if (front == 5) return 6;
	}
}

int main(){
	vector<long> roll(6);
	for (long i = 0; i < 6; i++) cin >> roll[i];
	long q;
	cin >> q;
	for (long i = 0; i < q; i++){
		long a, b;
		cin >> a >> b;
		cout << guessRightFromTopAndFront(a, b) << endl;
	}
	return 0;
}

Compiler output:
a.cc:7:44: error: redeclaration of 'long int Dice::right'
    7 |         long top, front, right, left, right, back, bottom;
      |                                            ^
a.cc:7:26: note: previous declaration 'long int Dice::right'
    7 |         long top, front, right, left, right, back, bottom;
      |                          ^~~~~
a.cc: In constructor 'Dice::Dice(long int, long int)':
a.cc:21:33: error: 'r' was not declared in this scope
   21 |                 if (front == 2) r = 3;
      |                                 ^
a.cc:22:38: error: 'r' was not declared in this scope
   22 |                 else if (front == 5) r = 4;
      |                                      ^
a.cc:23:38: error: 'r' was not declared in this scope
   23 |                 else if (front == 3) r = 5;
      |                                      ^
a.cc:24:38: error: 'r' was not declared in this scope
   24 |                 else if (front == 4) r = 2;
      |                                      ^
a.cc:27:33: error: 'r' was not declared in this scope
   27 |                 if (front == 2) r = 4;
      |                                 ^
a.cc:28:38: error: 'r' was not declared in this scope
   28 |                 else if (front == 5) r = 3;
      |                                      ^
a.cc:29:38: error: 'r' was not declared in this scope
   29 |                 else if (front == 3) r = 2;
      |                                      ^
a.cc:30:38: error: 'r' was not declared in this scope
   30 |                 else if (front == 4) r = 5;
      |                                      ^
a.cc:33:33: error: 'r' was not declared in this scope
   33 |                 if (front == 1) r = 4;
      |                                 ^
a.cc:34:38: error: 'r' was not declared in this scope
   34 |                 else if (front == 6) r = 3;
      |                                      ^
a.cc:35:38: error: 'r' was not declared in this scope
   35 |                 else if (front == 3) r = 1;
      |                                      ^
a.cc:36:38: error: 'r' was not declared in this scope
   36 |                 else if (front == 4) r = 6;
      |                                      ^
a.cc:39:33: error: 'r' was not declared in this scope
   39 |                 if (front == 1) r = 3;
      |                                 ^
a.cc:40:38: error: 'r' was not declared in this scope
   40 |                 else if (front == 6) r = 4;
      |                                      ^
a.cc:41:38: error: 'r' was not declared in this scope
   41 |                 else if (front == 3) r = 6;
      |                                      ^
a.cc:42:38: error: 'r' was not declared in this scope
   42 |                 else if (front == 4) r = 1;
      |                                      ^
a.cc:45:33: error: 'r' was not declared in this scope
   45 |                 if (front == 1) r = 2;
      |                                 ^
a.cc:46:38: error: 'r' was not declared in this scope
   46 |                 else if (front == 6) r = 5;
      |                                      ^
a.cc:47:38: error: 'r' was not declared in this scope
   47 |                 else if (front == 2) r = 6;
      |                                      ^
a.cc:48:38: error: 'r' was not declared in this scope
   48 |                 else if (front == 5) r = 1;
      |                                      ^
a.cc:51:33: error: 'r' was not declared in this scope
   51 |                 if (front == 1) r = 5;
      |                                 ^
a.cc:52:38: error: 'r' was not declared in this scope
   52 |                 else if (front == 6) r = 2;
      |                                      ^
a.cc:53:38: error: 'r' was not declared in this scope
   53 |                 else if (front == 2) r = 1;
      |                                      ^
a.cc:54:38: error: 'r' was not declared in this scope
   54 |                 else if (front == 5) r = 6;
      |                                      ^
a.cc:56:23: error: 'r' was not declared in this scope
   56 |         this->right = r;
      |                       ^
a.cc: At global scope:
a.cc:62:6: error: no declaration matches 'void Dice::north()'
   62 | void Dice::north(){
      |      ^~~~
a.cc:62:6: note: no functions named 'void Dice::north()'
a.cc:5:7: note: 'class Dice' defined here
    5 | class Dice{
      |       ^~~~
a.cc:79:6: error: no declaration matches 'void Dice::south()'
   79 | void Dice::south(){
      |      ^~~~
a.cc:79:6: note: no functions named 'void Dice::south()'
a.cc:5:7: note: 'class Dice' defined here
    5 | class Dice{
      |       ^~~~
a.cc:96:6: error: no declaration matches 'void Dice::west()'
   96 | void Dice::west(){
      |      ^~~~
a.cc:96:6: note: no functions named 'void Dice::west()'
a.cc:5:7: note: 'class Dice' defined here
    5 | class Dice{
      |       ^~~~
a.cc:113:6: error: no declaration matches 'void Dice::east()'
  113 | void Dice::east(){
      |      ^~~~
a.cc:113:6: note: no functions named 'void Dice::east()'
a.cc:5:7: note: 'class Dice' defined here
    5 | class Dice{
      |       ^~~~
a.cc:130:6: error: no declaration matches 'void Dice::showTop()'
  130 | void Dice::showTop(){
      |      ^~~~
a.cc:13:14: note: candidate is: 'long int Dice::showTop()'
   13 |         long showTop();
      |              ^~~~~~~
a.cc:5:7: note: 'class Dice' defined here
    5 | class Dice{
      |       ^~~~
a.cc: In function 'long int guessRightFromTopAndFront(long int, long int)':
a.cc:171:1: warning: control reaches end of non-void function [-Wreturn-type]
  171 | }
      | ^