Language: C++

#include<iostream>
using namespace std;

int main(){
    int n, a, b;
    int a[6]={};
    for (int i=0; i<6; i++) {
        cin >> a[i];
    }
    cin >> n;
    for (int i=0; i<n; i++) {
        cin >> a >> b;
        if (a==a[0]) {
            if (b==a[1]) {
                cout << a[2] << endl;
            } else if (b==a[2]) {
                cout << a[4] << endl;
            } else if (b==a[3]) {
                cout << a[1] << endl;
            } else if (b==a[4]) {
                cout << a[3] << endl;
            }
        } else if (a==a[1]) {
            if (b==a[0]) {
                cout << a[3] << endl;
            } else if (b==a[2]) {
                cout << a[0] << endl;
            } else if (b==a[3]) {
                cout << a[5] << endl;
            } else if (b==a[5]) {
                cout << a[2] << endl;
            }
        } else if (a==a[2]) {
            if (b==a[0]) {
                cout << a[1] << endl;
            } else if (b==a[1]) {
                cout << a[5] << endl;
            } else if (b==a[4]) {
                cout << a[0] << endl;
            } else if (b==a[5]) {
                cout << a[4] << endl;
            }
        } else if (a==a[3]) {
            if (b==a[0]) {
                cout << a[4] << endl;
            } else if (b==a[1]) {
                cout << a[0] << endl;
            } else if (b==a[4]) {
                cout << a[5] << endl;
            } else if (b==a[5]) {
                cout << a[1] << endl;
            }
        } else if (a==a[4]) {
            if (b==a[0]) {
                cout << a[2] << endl;
            } else if (b==a[2]) {
                cout << a[5] << endl;
            } else if (b==a[3]) {
                cout << a[0] << endl;
            } else if (b==a[5]) {
                cout << a[3] << endl;
            }
        } else if (a==a[5]) {
            if (b==a[1]) {
                cout << a[3] << endl;
            } else if (b==a[2]) {
                cout << a[1] << endl;
            } else if (b==a[3]) {
                cout << a[4] << endl;
            } else if (b==a[4]) {
                cout << a[2] << endl;
            }
        } 
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:6:9: error: conflicting declaration 'int a [6]'
    6 |     int a[6]={};
      |         ^
a.cc:5:12: note: previous declaration as 'int a'
    5 |     int n, a, b;
      |            ^
a.cc:8:17: error: invalid types 'int[int]' for array subscript
    8 |         cin >> a[i];
      |                 ^
a.cc:13:17: error: invalid types 'int[int]' for array subscript
   13 |         if (a==a[0]) {
      |                 ^
a.cc:14:21: error: invalid types 'int[int]' for array subscript
   14 |             if (b==a[1]) {
      |                     ^
a.cc:15:26: error: invalid types 'int[int]' for array subscript
   15 |                 cout << a[2] << endl;
      |                          ^
a.cc:16:28: error: invalid types 'int[int]' for array subscript
   16 |             } else if (b==a[2]) {
      |                            ^
a.cc:17:26: error: invalid types 'int[int]' for array subscript
   17 |                 cout << a[4] << endl;
      |                          ^
a.cc:18:28: error: invalid types 'int[int]' for array subscript
   18 |             } else if (b==a[3]) {
      |                            ^
a.cc:19:26: error: invalid types 'int[int]' for array subscript
   19 |                 cout << a[1] << endl;
      |                          ^
a.cc:20:28: error: invalid types 'int[int]' for array subscript
   20 |             } else if (b==a[4]) {
      |                            ^
a.cc:21:26: error: invalid types 'int[int]' for array subscript
   21 |                 cout << a[3] << endl;
      |                          ^
a.cc:23:24: error: invalid types 'int[int]' for array subscript
   23 |         } else if (a==a[1]) {
      |                        ^
a.cc:24:21: error: invalid types 'int[int]' for array subscript
   24 |             if (b==a[0]) {
      |                     ^
a.cc:25:26: error: invalid types 'int[int]' for array subscript
   25 |                 cout << a[3] << endl;
      |                          ^
a.cc:26:28: error: invalid types 'int[int]' for array subscript
   26 |             } else if (b==a[2]) {
      |                            ^
a.cc:27:26: error: invalid types 'int[int]' for array subscript
   27 |                 cout << a[0] << endl;
      |                          ^
a.cc:28:28: error: invalid types 'int[int]' for array subscript
   28 |             } else if (b==a[3]) {
      |                            ^
a.cc:29:26: error: invalid types 'int[int]' for array subscript
   29 |                 cout << a[5] << endl;
      |                          ^
a.cc:30:28: error: invalid types 'int[int]' for array subscript
   30 |             } else if (b==a[5]) {
      |                            ^
a.cc:31:26: error: invalid types 'int[int]' for array subscript
   31 |                 cout << a[2] << endl;
      |                          ^
a.cc:33:24: error: invalid types 'int[int]' for array subscript
   33 |         } else if (a==a[2]) {
      |                        ^
a.cc:34:21: error: invalid types 'int[int]' for array subscript
   34 |             if (b==a[0]) {
      |                     ^
a.cc:35:26: error: invalid types 'int[int]' for array subscript
   35 |                 cout << a[1] << endl;
      |                          ^
a.cc:36:28: error: invalid types 'int[int]' for array subscript
   36 |             } else if (b==a[1]) {
      |                            ^
a.cc:37:26: error: invalid types 'int[int]' for array subscript
   37 |                 cout << a[5] << endl;
      |                          ^
a.cc:38:28: error: invalid types 'int[int]' for array subscript
   38 |             } else if (b==a[4]) {
      |                            ^
a.cc:39:26: error: invalid types 'int[int]' for array subscript
   39 |                 cout << a[0] << endl;
      |                          ^
a.cc:40:28: error: invalid types 'int[int]' for array subscript
   40 |             } else if (b==a[5]) {
      |                            ^
a.cc:41:26: error: invalid types 'int[int]' for array subscript
   41 |                 cout << a[4] << endl;
      |                          ^
a.cc:43:24: error: invalid types 'int[int]' for array subscript
   43 |         } else if (a==a[3]) {
      |                        ^
a.cc:44:21: error: invalid types 'int[int]' for array subscript
   44 |             if (b==a[0]) {
      |                     ^
a.cc:45:26: error: invalid types 'int[int]' for array subscript
   45 |                 cout << a[4] << endl;
      |                          ^
a.cc:46:28: error: invalid types 'int[int]' for array subscript
   46 |             } else if (b==a[1]) {
      |                            ^
a.cc:47:26: error: invalid types 'int[int]' for array subscript
   47 |                 cout << a[0] << endl;
      |                          ^
a.cc:48:28: error: invalid types 'int[int]' for array subscript
   48 |             } else if (b==a[4]) {
      |                            ^
a.cc:49:26: error: invalid types 'int[int]' for array subscript
   49 |                 cout << a[5] << endl;
      |                          ^
a.cc:50:28: error: invalid types 'int[int]' for array subscript
   50 |             } else if (b==a[5]) {
      |                            ^
a.cc:51:26: error: invalid types 'int[int]' for array subscript
   51 |                 cout << a[1] << endl;
      |                          ^
a.cc:53:24: error: invalid types 'int[int]' for array subscript
   53 |         } else if (a==a[4]) {
      |                        ^
a.cc:54:21: error: invalid types 'int[int]' for array subscript
   54 |             if (b==a[0]) {
      |                     ^
a.cc:55:26: error: invalid types 'int[int]' for array subscript
   55 |                 cout << a[2] << endl;
      |                          ^
a.cc:56:28: error: invalid types 'int[int]' for array subscript
   56 |             } else if (b==a[2]) {
      |                            ^
a.cc:57:26: error: invalid types 'int[int]' for array subscript
   57 |                 cout << a[5] << endl;
      |                          ^
a.cc:58:28: error: invalid types 'int[int]' for array subscript
   58 |             } else if (b==a[3]) {
      |                            ^
a.cc:59:26: error: invalid types 'int[int]' for array subscript
   59 |                 cout << a[0] << endl;
      |                          ^
a.cc:60:28: error: invalid types 'int[int]' for array subscript
   60 |             } else if (b==a[5]) {
      |                            ^
a.cc:61:26: error: invalid types 'int[int]' for array subscript
   61 |                 cout << a[3] << endl;
      |                          ^
a.cc:63:24: error: invalid types 'int[int]' for array subscript
   63 |         } else if (a==a[5]) {
      |                        ^
a.cc:64:21: error: invalid types 'int[int]' for array subscript
   64 |             if (b==a[1]) {
      |                     ^
a.cc:65:26: error: invalid types 'int[int]' for array subscript
   65 |                 cout << a[3] << endl;
      |                          ^
a.cc:66:28: error: invalid types 'int[int]' for array subscript
   66 |             } else if (b==a[2]) {
      |                            ^
a.cc:67:26: error: invalid types 'int[int]' for array subscript
   67 |                 cout << a[1] << endl;
      |                          ^
a.cc:68:28: error: invalid types 'int[int]' for array subscript
   68 |             } else if (b==a[3]) {
      |                            ^
a.cc:69:26: error: invalid types 'int[int]' for array subscript
   69 |                 cout << a[4] << endl;
      |                          ^
a.cc:70:28: error: invalid types 'int[int]' for array subscript
   70 |             } else if (b==a[4]) {
      |                            ^
a.cc:71:26: error: invalid types 'int[int]' for array subscript
   71 |                 cout << a[2] << endl;
      |                          ^