Language: C++

#include <iostream>
#include <queue>
#include <algorithm>
using namespace std;

class FC{
public:
    int p[31];
    int n;
        
    bool is_over(){
     	return p[1]==p[2] && p[2]==p[3] && p[3]==p[4] && p[4]==p[5] &&
        	p[5]==p[6] && p[6]==p[7] && p[7]==p[8] && p[8]==p[9] &&
        	p[10]==p[11] && p[11]==p[12] &&
      		p[13]==p[14] && p[14]==p[15] &&
      		p[16]==p[17] && p[17]==p[18] &&
      		p[19]==p[20] && p[20]==p[21];
     }
          
    void rot1()
    {
        swap(p[7], p[22]);  swap(p[8], p[23]);  swap(p[9], p[24]);
        swap(p[10], p[12]);  swap(p[13], p[18]);
    }
 
    void rot2()
    {
        swap(p[1], p[28]);  swap(p[2], p[29]);  swap(p[3], p[30]);
        swap(p[19], p[21]);  swap(p[15], p[16]);
    }
 
    void rot3()
    {
        swap(p[1], p[24]);  swap(p[4], p[27]);  swap(p[7], p[30]);
        swap(p[16], p[18]);  swap(p[10], p[21]);
    }
 
    void rot4()
    {
        swap(p[3], p[22]);  swap(p[6], p[25]);  swap(p[9], p[28]);
        swap(p[13], p[15]);  swap(p[12], p[19]);
    }
};
 
int main()
{
    int N;
    cin >> N;
 
    for(int i=0; i<N; i++){
        FC now;
        for(int j=1; j<=30; j++){
            cin >> now.p[j];
        }
        now.n = 0;
 
        queue<State> que;
        que.push(now);
 
        while(!que.empty()){
            now = que.front();
            que.pop();
 
            if(now.is_over()){
                cout << now.n << endl;
                break;
            }
 
            FC nex1 = now;  nex1.rot1();  nex1.n++;  que.push(nex1);
            FC nex2 = now;  nex2.rot2();  nex2.n++;  que.push(nex2);
            FC nex3 = now;  nex3.rot3();  nex3.n++;  que.push(nex3);
            FC nex4 = now;  nex4.rot4();  nex4.n++;  que.push(nex4);
        }
    }
 
    return 0;
}  

Compiler output:
a.cc: In function 'int main()':
a.cc:57:15: error: 'State' was not declared in this scope
   57 |         queue<State> que;
      |               ^~~~~
a.cc:57:20: error: template argument 1 is invalid
   57 |         queue<State> que;
      |                    ^
a.cc:57:20: error: template argument 2 is invalid
a.cc:58:13: error: request for member 'push' in 'que', which is of non-class type 'int'
   58 |         que.push(now);
      |             ^~~~
a.cc:60:20: error: request for member 'empty' in 'que', which is of non-class type 'int'
   60 |         while(!que.empty()){
      |                    ^~~~~
a.cc:61:23: error: request for member 'front' in 'que', which is of non-class type 'int'
   61 |             now = que.front();
      |                       ^~~~~
a.cc:62:17: error: request for member 'pop' in 'que', which is of non-class type 'int'
   62 |             que.pop();
      |                 ^~~
a.cc:69:58: error: request for member 'push' in 'que', which is of non-class type 'int'
   69 |             FC nex1 = now;  nex1.rot1();  nex1.n++;  que.push(nex1);
      |                                                          ^~~~
a.cc:70:58: error: request for member 'push' in 'que', which is of non-class type 'int'
   70 |             FC nex2 = now;  nex2.rot2();  nex2.n++;  que.push(nex2);
      |                                                          ^~~~
a.cc:71:58: error: request for member 'push' in 'que', which is of non-class type 'int'
   71 |             FC nex3 = now;  nex3.rot3();  nex3.n++;  que.push(nex3);
      |                                                          ^~~~
a.cc:72:58: error: request for member 'push' in 'que', which is of non-class type 'int'
   72 |             FC nex4 = now;  nex4.rot4();  nex4.n++;  que.push(nex4);
      |                                                          ^~~~