Language: C++

#include <iostream>
#include <cmath>
#include <iomanip>
#include <vector>

#define NUM_S 6
#define SIZE 100

using namespace std;

class Dice {
public:
	Dice(const int n[NUM_S]);

	int roll(char);
	int rollF();
	int rollR();
	int rollL();
	int rollB();
	int rollCwise();

	int getTop();
	int getF();
	int getR();
	int getL();
	int getB();
	int getBottom();

	void show();

private:
	int top, front, right, left, back, bottom;
};

bool sameDice(Dice, Dice);
bool inDice(int, Dice);


int main(void){
	int n, s[SIZE][NUM_S];
	vector<Dice> d;
	bool same = false;

	cin >> n;

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

	for (int i = 0; i < n; i++) {
		d.emplace_back(s[i]);
	}

	for (int i = 1; i < n; i++) {
		d[0].show();
		d[i].show();
		if (!inDice(d[0].getTop(), d[i])) {
			continue;
		}
		if (d[i].getR() == d[0].getTop() || d[i].getL() == d[0].getTop()) {
			d[i].rollR();
			d[0].show();
			d[i].show();
		}
		while (d[i].getTop() != d[0].getTop()) {
			d[i].rollF();
			d[0].show();
			d[i].show();
		}
		if (!inDice(d[0].getR(), d[i]) || d[0].getR == d[i].getBottom()) {
			continue;
		}
		while (d[i].getR() != d[0].getR()) {
			d[i].rollCwise();
			d[0].show();
			d[i].show();
		}
		if (sameDice(d[0], d[i])) {
			d[0].show();
			d[i].show();
			same = true;
			cout << i << "false\n";
			break;
		}
		else {
			cout << i << "true\n";
		}
	}

	if (same) {
		cout << "No\n";
	}
	else {
		cout << "Yes\n";
	}
	cin >> n;
	return 0;
}


Dice::Dice(const int n[NUM_S]) {
	top = n[0];
	front = n[1];
	right = n[2];
	left = n[3];
	back = n[4];
	bottom = n[5];
}

int Dice::roll(char c) {
	if (c == 'S') {
		return rollF();
	}
	else if (c == 'E') {
		return rollR();
	}
	else if (c == 'W') {
		return rollL();
	}
	else if (c == 'N') {
		return rollB();
	}
	else {
		return 0;
	}
}

int Dice::rollF() {
	int buf = top;
	top = back;
	back = bottom;
	bottom = front;
	front = buf;
	return top;
}

int Dice::rollR() {
	int buf = top;
	top = left;
	left = bottom;
	bottom = right;
	right = buf;
	return top;
}

int Dice::rollL() {
	int buf = top;
	top = right;
	right = bottom;
	bottom = left;
	left = buf;
	return top;
}

int Dice::rollB() {
	int buf = top;
	top = front;
	front = bottom;
	bottom = back;
	back = buf;
	return top;
}

int Dice::rollCwise() {
	int buf = left;
	left = front;
	front = right;
	right = back;
	back = buf;
	return top;
}

int Dice::getTop() {
	return top;
}

int Dice::getF() {
	return front;
}

int Dice::getR() {
	return right;
}


int Dice::getL() {
	return left;
}


int Dice::getB() {
	return back;
}


int Dice::getBottom() {
	return bottom;
}


void Dice::show() {
	cout << "Top:" << top << "\n";
	cout << "Front:" << front << "\n";
	cout << "Right:" << right << "\n";
	cout << "Left:" << left << "\n";
	cout << "Back:" << back << "\n";
	cout << "Bottom:" << bottom << "\n";
	cout << "===\n";
}

bool sameDice(Dice d1, Dice d2) {
	if (d1.getTop() == d2.getTop() && d1.getF() == d2.getF() && d1.getR() == d2.getR() && d1.getL() == d2.getL() && d1.getB() == d2.getB() && d1.getBottom() == d2.getBottom()) {
		return true;
	}
	else {
		return false;
	}
}

bool inDice(int n, Dice d) {
	if (n == d.getTop() || n == d.getF() || n == d.getR() || n == d.getL() || n = d.getB() || n == d.getBottom()) {
		return true;
	}
	else {
		return false;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:72:56: error: invalid use of member function 'int Dice::getR()' (did you forget the '()' ?)
   72 |                 if (!inDice(d[0].getR(), d[i]) || d[0].getR == d[i].getBottom()) {
      |                                                            ()
a.cc: In function 'bool inDice(int, Dice)':
a.cc:223:80: error: lvalue required as left operand of assignment
  223 |         if (n == d.getTop() || n == d.getF() || n == d.getR() || n == d.getL() || n = d.getB() || n == d.getBottom()) {
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
a.cc:229:1: warning: control reaches end of non-void function [-Wreturn-type]
  229 | }
      | ^