Language: C++

#include <iostream>
using namespace std;

#define check cnt=0;for(j=0;j<6;j++)if(d[q][j]==d[r][j])cnt++;
#define m tmp=d[r][1];d[r][1]=d[r][3];d[r][3]=d[r][4];d[r][4]=d[r][2];d[r][2]=tmp;
#define y tmp=d[r][0];d[r][0]=d[r][3];d[r][3]=d[r][5];d[r][5]=d[r][2];d[r][2]=tmp;

int CHECK(int d[][6],q,r){
 int tmp,cnt,j,a=1,i,k
 check
 if(cnt==6)a=0;

 while(a){
  for(i=0;i<5;i++){
   for(k=0;k<4;k++){
    check
    if(cnt==6)break;
    m
   }
   check
   if(cnt==6)break;
   tmp=d[r][0];
   d[r][0]=d[r][1];
   d[r][1]=d[r][5];
   d[r][5]=d[r][4];
   d[r][4]=tmp;
  }
  if(cnt==6)break;
  y
  for(k=0;k<4;k++){
   check
   if(cnt==6)break;
   m
  }
  if(cnt==6)break;
  y
  y
  for(k=0;k<4;k++){
   check
   if(cnt==6)break;
   m
  }
  if(cnt==6)break;
  a=0;
 }

 if(cnt==6)return 1;
 else return 0;
}

int main(){
 int i,n;

 cin >> n;

 for(i=0;i<n;i++){
  for(int j=0;j<6;j++){
   cin >> d[i][j] ;
  }
 }

 for(i=0;i<n-1;i++){
  if(CHECK(d,i,i+1)==0)break;
 }

 if(i==n-2)cout << "Yes" << endl;
 else cout << "No" << endl;

 
 return 0;
}

Compiler output:
a.cc:8:22: error: 'q' has not been declared
    8 | int CHECK(int d[][6],q,r){
      |                      ^
a.cc:8:24: error: 'r' has not been declared
    8 | int CHECK(int d[][6],q,r){
      |                        ^
a.cc: In function 'int CHECK(int (*)[6], int, int)':
a.cc:4:15: error: expected initializer before 'cnt'
    4 | #define check cnt=0;for(j=0;j<6;j++)if(d[q][j]==d[r][j])cnt++;
      |               ^~~
a.cc:10:2: note: in expansion of macro 'check'
   10 |  check
      |  ^~~~~
a.cc:4:42: error: 'q' was not declared in this scope
    4 | #define check cnt=0;for(j=0;j<6;j++)if(d[q][j]==d[r][j])cnt++;
      |                                          ^
a.cc:10:2: note: in expansion of macro 'check'
   10 |  check
      |  ^~~~~
a.cc:4:51: error: 'r' was not declared in this scope
    4 | #define check cnt=0;for(j=0;j<6;j++)if(d[q][j]==d[r][j])cnt++;
      |                                                   ^
a.cc:10:2: note: in expansion of macro 'check'
   10 |  check
      |  ^~~~~
a.cc:15:8: error: 'k' was not declared in this scope
   15 |    for(k=0;k<4;k++){
      |        ^
a.cc:4:42: error: 'q' was not declared in this scope
    4 | #define check cnt=0;for(j=0;j<6;j++)if(d[q][j]==d[r][j])cnt++;
      |                                          ^
a.cc:16:5: note: in expansion of macro 'check'
   16 |     check
      |     ^~~~~
a.cc:4:51: error: 'r' was not declared in this scope
    4 | #define check cnt=0;for(j=0;j<6;j++)if(d[q][j]==d[r][j])cnt++;
      |                                                   ^
a.cc:16:5: note: in expansion of macro 'check'
   16 |     check
      |     ^~~~~
a.cc:5:17: error: 'r' was not declared in this scope
    5 | #define m tmp=d[r][1];d[r][1]=d[r][3];d[r][3]=d[r][4];d[r][4]=d[r][2];d[r][2]=tmp;
      |                 ^
a.cc:18:5: note: in expansion of macro 'm'
   18 |     m
      |     ^
a.cc:4:42: error: 'q' was not declared in this scope
    4 | #define check cnt=0;for(j=0;j<6;j++)if(d[q][j]==d[r][j])cnt++;
      |                                          ^
a.cc:20:4: note: in expansion of macro 'check'
   20 |    check
      |    ^~~~~
a.cc:4:51: error: 'r' was not declared in this scope
    4 | #define check cnt=0;for(j=0;j<6;j++)if(d[q][j]==d[r][j])cnt++;
      |                                                   ^
a.cc:20:4: note: in expansion of macro 'check'
   20 |    check
      |    ^~~~~
a.cc:22:10: error: 'r' was not declared in this scope
   22 |    tmp=d[r][0];
      |          ^
a.cc:6:17: error: 'r' was not declared in this scope
    6 | #define y tmp=d[r][0];d[r][0]=d[r][3];d[r][3]=d[r][5];d[r][5]=d[r][2];d[r][2]=tmp;
      |                 ^
a.cc:29:3: note: in expansion of macro 'y'
   29 |   y
      |   ^
a.cc:30:7: error: 'k' was not declared in this scope
   30 |   for(k=0;k<4;k++){
      |       ^
a.cc:4:42: error: 'q' was not declared in this scope
    4 | #define check cnt=0;for(j=0;j<6;j++)if(d[q][j]==d[r][j])cnt++;
      |                                          ^
a.cc:31:4: note: in expansion of macro 'check'
   31 |    check
      |    ^~~~~
a.cc:38:7: error: 'k' was not declared in this scope
   38 |   for(k=0;k<4;k++){
      |       ^
a.cc:4:42: error: 'q' was not declared in this scope
    4 | #define check cnt=0;for(j=0;j<6;j++)if(d[q][j]==d[r][j])cnt++;
      |                                          ^
a.cc:39:4: note: in expansion of macro 'check'
   39 |    check
      |    ^~~~~
a.cc: In function 'int main()':
a.cc:58:11: error: 'd' was not declared in this scope
   58 |    cin >> d[i][j] ;
      |           ^
a.cc:63:12: error: 'd' was not declared in this scope
   63 |   if(CHECK(d,i,i+1)==0)break;
      |            ^