Language: C++

#include <iostream>
using namespace std;

void EAST(int dice[100][6], int k) {
    int copy = dice[k][0];
    dice[k][0] = dice[k][3];
    dice[k][3] = dice[k][5];
    dice[k][5] = dice[k][2];
    dice[k][2] = copy;
}

void NORTH(int dice[100][6], int k) {
    int copy = dice[k][0];
    dice[k][0] = dice[k][1];
    dice[k][1] = dice[k][5];
    dice[k][5] = dice[k][4];
    dice[k][4] = copy;
}

void ROTATE(int dice[100][6], int index, int k) {
    switch(index) {
        case 1 : break;
        case 2 : {
            int copy = dice[k][1];
            dice[k][1] = dice[k][2];
            dice[k][2] = dice[k][4];
            dice[k][4] = dice[k][3];
            dice[k][3] = copy;
            break;
        }
        case 4 : {
            int copy = dice[k][1];
            dice[k][1] = dice[k][4];
            dice[k][4] = copy;
            copy = dice[k][2];
            dice[k][2] = dice[k][3];
            dice[k][3] = copy;
            break;
        }
        case 3 : {
            int copy = dice[k][1];
            dice[k][1] = dice[k][3];
            dice[k][3] = dice[k][4];
            dice[k][4] = dice[k][2];
            dice[k][2] = copy;
            break;
        }
    }
}

int main(void) {
    int n;
    int DICE = 0;
    int dice[100][6];
    int dice_sub[6];
    
    for(int i = 0; i < n; ++i) {
        for(int j = 0; j < 6; ++j) {
            cin >> dice[i][j];
        }
    
    for(int k = 1; k < n; ++k) {
        for(int l = 0; l < 6; ++l) {
            dice_sub[l] = dice[k][l];
        }
    
        for(int i = 0; i < 4; ++i) {
            EAST(dice, 0);
            int check = 0;
            for(int j = 0; j < 6; ++j) {
                dice[k][j] = dice_sub[j];
            }
            int start = dice[k][0];
            while(dice[k][0] != dice[0][0]) {
                EAST(dice, k);
                if(dice[k][0] == dice[0][0])   break;
                NORTH(dice, k);
                if(dice[k][0] == start) {
                    break;
                }
            }
        
            int index = 1;
            while(true) {
                if(dice[k][index] == dice[0][1])   break;
                ++index;
                if(index == 5) {
                    break;
                }
            }
            ROTATE(dice, index, k);
            for(int i = 0; i < 6; ++i) {
                if(dice[0][i] == dice[k][i]) {
                    ++check;
                }
            }
            if(check == 6) {
                cout << "Yes" << endl;
                return 0;
            }
        }
        for(int i = 0; i < 4; ++i) {
            NORTH(dice, k);
            int check = 0;
            for(int j = 0; j < 6; ++j) {
                dice[k][j] = dice_sub[j];
            }
            int start = dice[k][0];
            while(dice[k][0] != dice[0][0]) {
                EAST(dice, k);
                if(dice[k][0] == dice[0][0])   break;
                NORTH(dice, k);
                if(dice[k][0] == start) {
                    break;
                }
            }
            
            int index = 1;
            while(true) {
                if(dice[k][index] == dice1[1])   break;
                ++index;
                if(index == 5) {
                    break;
                }
            }
            ROTATE(dice, index, k);
            for(int i = 0; i < 6; ++i) {
                if(dice1[i] == dice[k][i]) {
                    ++check;
                }
            }
            if(check == 6) {
                ++DICE;
            }
        }
    }
    if(DICE == n)   cout << "Yes" << endl;
    else            cout << "No" << endl;
    
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:120:38: error: 'dice1' was not declared in this scope; did you mean 'dice'?
  120 |                 if(dice[k][index] == dice1[1])   break;
      |                                      ^~~~~
      |                                      dice
a.cc:128:20: error: 'dice1' was not declared in this scope; did you mean 'dice'?
  128 |                 if(dice1[i] == dice[k][i]) {
      |                    ^~~~~
      |                    dice
a.cc:141:2: error: expected '}' at end of input
  141 | }
      |  ^
a.cc:51:16: note: to match this '{'
   51 | int main(void) {
      |                ^