``` #include <iostream> #include <cmath> using namespace std; bool isClose(double a, double b) { const double epsilon = 1e-6; return fabs(a - b) < epsilon; } double calculateDistance(double x1, double y1, double x2, double y2) { return sqrt(pow(x2 - x1, 2) + pow(y2 - y1, 2)); } bool areTrianglesCongruent(double x1, double y1, double x2, double y2, double x3, double y3, double tx1, double ty1, double tx2, double ty2, double tx3, double ty3, double tx4, double ty4, double tx5, double ty5, double tx6, double ty6) { double a = calculateDistance(x1, y1, x2, y2); double b = calculateDistance(x2, y2, x3, y3); double c = calculateDistance(x3, y3, x1, y1); double ta1 = calculateDistance(tx1, ty1, tx2, ty2); double tb1 = calculateDistance(tx2, ty2, tx3, ty3); double tc1 = calculateDistance(tx3, ty3, tx1, ty1); double ta2 = calculateDistance(tx4, ty4, tx5, ty5); double tb2 = calculateDistance(tx5, ty5, tx6, ty6); double tc2 = calculateDistance(tx6, ty6, tx4, ty4); bool sidesCongruentWithTriangle1 = (isClose(a, ta1) && isClose(b, tb1) && isClose(c, tc1)) || (isClose(a, tb1) && isClose(b, tc1) && isClose(c, ta1)) || (isClose(a, tc1) && isClose(b, ta1) && isClose(c, tb1)); bool sidesCongruentWithTriangle2 = (isClose(a, ta2) && isClose(b, tb2) && isClose(c, tc2)) || (isClose(a, tb2) && isClose(b, tc2) && isClose(c, ta2)) || (isClose(a, tc2) && isClose(b, ta2) && isClose(c, tb2)); return sidesCongruentWithTriangle1 || sidesCongruentWithTriangle2; } int main() { double tx1, ty1; double tx2, ty2; double tx3, ty3; double tx4, ty4; double tx5, ty5; double tx6, ty6; cin >> tx1 >> ty1 >> tx2 >> ty2 >> tx3 >> ty3; cin >> tx4 >> ty4 >> tx5 >> ty5 >> tx6 >> ty6; int n; cin >> n; for (int i = 0; i < n; i++) { double x1, y1; double x2, y2; double x3, y3; cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3; bool congruentWithTriangle1 = areTrianglesCongruent(x1, y1, x2, y2, x3, y3, tx1, ty1, tx2, ty2, tx3, ty3, tx4, ty4, tx5, ty5, tx6, ty6); if (congruentWithTriangle1) { cout<< "Nijika" << endl; } else { bool congruentWithTriangle2 = areTrianglesCongruent(x1, y1, x2, y2, x3, y3, tx4, ty4, tx5, ty5, tx6, ty6, tx1, ty1, tx2, ty2, tx3, ty3); if (congruentWithTriangle2) { cout << "Doritos" << endl; } else { cout << "None" << endl; } } } return 0; } ```