QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#233890#7636. Fair Electionsucup-team296AC ✓3059ms288000kbC++142.6kb2023-11-01 04:50:172023-11-01 04:50:18

Judging History

你现在查看的是最新测评结果

  • [2023-11-01 04:50:18]
  • 评测
  • 测评结果:AC
  • 用时:3059ms
  • 内存:288000kb
  • [2023-11-01 04:50:17]
  • 提交

answer

#include <bits/stdc++.h>

#define long long long int
#define short int16_t
#define DEBUG
using namespace std;

// @author: pashka

const int MAX = 10002;

short d[MAX][MAX];
short z[MAX][MAX];

bool interesting(int i, int j) {
    if (d[i + 1][j] != d[i][j]) return true;
    if (d[i][j + 1] != d[i][j]) return true;
    return false;
}

void print() {
    for (auto &a: d) {
        for (auto x: a) {
            cout << x << " ";
        }
        cout << "\n";
    }
    cout << "\n";
}

int main() {
    ios::sync_with_stdio(false);

    int n;
    cin >> n;
    vector<vector<int>> a(n, vector<int>(3));
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < 3; j++) {
            cin >> a[i][j];
            a[i][j]--;
        }
    }

    for (int i = 0; i <= n; i++) {
        for (int j = 0; j <= n; j++) {
            int k = n - i - j;
            if (k >= 0 && k <= n) {
                if (i >= j && i >= k) {
                    d[i][j] = 0;
                } else if (j >= k) {
                    d[i][j] = 1;
                } else {
                    d[i][j] = 2;
                }
            }
        }
    }

    vector<pair<int, int>> fr;

    for (int i = 0; i <= n; i++) {
        for (int j = 0; j <= n; j++) {
            if (d[i][j] == -1) continue;
            if (interesting(i, j)) fr.push_back({i, j});
        }
    }


//    print();

    for (int t = n - 1; t >= 0; t--) {
        vector<pair<int, int>> nfr;

        vector<pair<pair<int, int>, int>> ch;

        for (auto [i, j]: fr) {
            int r = -1;
            for (int x: a[t]) {
                if (d[i][j + 1] == x || d[i + 1][j] == x || d[i][j] == x) {
                    r = x;
                    break;
                }
            }
            ch.push_back({{i, j}, r});
            int rr = d[i][j];
            d[i][j] = r;
            if (i > 0 && z[i - 1][j] != t && interesting(i - 1, j)) {
                nfr.push_back({i - 1, j});
                z[i - 1][j] = t;
            };
            if (j > 0 && z[i][j - 1] != t && interesting(i, j - 1)) {
                nfr.push_back({i, j - 1});
                z[i][j - 1] = t;
            }
            if (z[i][j] != t && interesting(i, j)) {
                nfr.push_back({i, j});
                z[i][j] = t;
            };
            d[i][j] = rr;
        }
        for (auto [p, r]: ch) {
            auto [i, j] = p;
            d[i][j] = r;
        }

        fr = nfr;
        assert(fr.size() <= 50000);
//        cout << fr.size() << "\n";
//        print();
    }
    cout << d[0][0] + 1 << "\n";

    return 0;
}

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 5676kb

input:

3
3 2 1
1 2 3
2 1 3

output:

2

result:

ok 1 number(s): "2"

Test #2:

score: 0
Accepted
time: 1ms
memory: 5648kb

input:

5
1 2 3
2 3 1
1 3 2
3 1 2
2 1 3

output:

1

result:

ok 1 number(s): "1"

Test #3:

score: 0
Accepted
time: 1ms
memory: 5708kb

input:

5
1 2 3
3 2 1
1 2 3
1 2 3
3 2 1

output:

1

result:

ok 1 number(s): "1"

Test #4:

score: 0
Accepted
time: 1ms
memory: 5756kb

input:

5
3 2 1
3 1 2
2 3 1
1 2 3
2 1 3

output:

2

result:

ok 1 number(s): "2"

Test #5:

score: 0
Accepted
time: 1ms
memory: 5736kb

input:

5
3 2 1
3 2 1
1 3 2
1 3 2
3 2 1

output:

3

result:

ok 1 number(s): "3"

Test #6:

score: 0
Accepted
time: 1ms
memory: 5740kb

input:

5
3 2 1
3 1 2
1 2 3
1 3 2
1 3 2

output:

1

result:

ok 1 number(s): "1"

Test #7:

score: 0
Accepted
time: 1ms
memory: 5732kb

input:

20
1 2 3
2 3 1
1 3 2
3 1 2
2 1 3
1 2 3
3 2 1
1 2 3
1 2 3
3 2 1
3 2 1
3 1 2
2 3 1
1 2 3
2 1 3
3 2 1
3 2 1
1 3 2
1 3 2
3 2 1

output:

1

result:

ok 1 number(s): "1"

Test #8:

score: 0
Accepted
time: 1ms
memory: 5736kb

input:

20
3 2 1
3 1 2
1 2 3
1 3 2
1 3 2
1 2 3
3 1 2
1 3 2
3 2 1
1 3 2
2 1 3
3 1 2
2 3 1
2 1 3
2 3 1
3 1 2
3 1 2
2 1 3
3 1 2
1 2 3

output:

1

result:

ok 1 number(s): "1"

Test #9:

score: 0
Accepted
time: 1ms
memory: 5736kb

input:

20
1 2 3
2 3 1
2 1 3
2 1 3
1 3 2
3 1 2
2 3 1
1 3 2
3 1 2
1 2 3
1 2 3
3 2 1
3 1 2
1 2 3
3 2 1
1 2 3
2 3 1
3 1 2
3 2 1
3 2 1

output:

3

result:

ok 1 number(s): "3"

Test #10:

score: 0
Accepted
time: 1ms
memory: 7724kb

input:

20
3 1 2
3 2 1
1 2 3
1 3 2
1 3 2
2 3 1
1 3 2
2 3 1
1 2 3
3 2 1
1 2 3
3 2 1
1 2 3
1 2 3
3 2 1
2 3 1
2 3 1
1 2 3
2 1 3
2 1 3

output:

1

result:

ok 1 number(s): "1"

Test #11:

score: 0
Accepted
time: 1ms
memory: 5736kb

input:

20
2 1 3
2 1 3
3 1 2
3 2 1
2 1 3
1 2 3
2 3 1
3 1 2
3 1 2
2 3 1
3 2 1
1 3 2
2 1 3
2 1 3
1 2 3
2 3 1
2 3 1
3 2 1
2 1 3
1 3 2

output:

2

result:

ok 1 number(s): "2"

Test #12:

score: 0
Accepted
time: 2919ms
memory: 287744kb

input:

10000
1 2 3
2 3 1
1 3 2
3 1 2
2 1 3
1 2 3
3 2 1
1 2 3
1 2 3
3 2 1
3 2 1
3 1 2
2 3 1
1 2 3
2 1 3
3 2 1
3 2 1
1 3 2
1 3 2
3 2 1
3 2 1
3 1 2
1 2 3
1 3 2
1 3 2
1 2 3
3 1 2
1 3 2
3 2 1
1 3 2
2 1 3
3 1 2
2 3 1
2 1 3
2 3 1
3 1 2
3 1 2
2 1 3
3 1 2
1 2 3
1 2 3
2 3 1
2 1 3
2 1 3
1 3 2
3 1 2
2 3 1
1 3 2
3 1 2
...

output:

3

result:

ok 1 number(s): "3"

Test #13:

score: 0
Accepted
time: 2985ms
memory: 285912kb

input:

10000
2 1 3
1 3 2
3 2 1
3 1 2
1 3 2
2 1 3
2 3 1
1 3 2
1 3 2
2 1 3
3 2 1
3 1 2
3 1 2
3 1 2
2 3 1
1 2 3
3 2 1
2 1 3
3 2 1
3 1 2
2 1 3
1 2 3
2 1 3
2 1 3
2 1 3
2 1 3
2 3 1
2 3 1
3 2 1
3 2 1
3 1 2
3 2 1
1 2 3
1 2 3
1 2 3
2 3 1
1 3 2
1 2 3
2 3 1
1 3 2
2 1 3
2 3 1
2 3 1
3 1 2
1 3 2
3 1 2
3 2 1
1 2 3
1 3 2
...

output:

3

result:

ok 1 number(s): "3"

Test #14:

score: 0
Accepted
time: 2878ms
memory: 287700kb

input:

10000
3 2 1
3 1 2
3 2 1
3 2 1
3 1 2
1 3 2
3 1 2
1 3 2
2 3 1
1 3 2
3 1 2
3 2 1
3 1 2
1 2 3
3 2 1
3 1 2
3 1 2
1 2 3
2 3 1
3 1 2
3 2 1
3 2 1
3 2 1
2 3 1
3 1 2
3 1 2
1 2 3
3 2 1
3 1 2
3 1 2
1 2 3
2 3 1
3 1 2
2 1 3
1 2 3
2 3 1
2 3 1
1 2 3
3 1 2
2 1 3
1 3 2
1 2 3
1 2 3
1 2 3
1 3 2
3 1 2
1 2 3
2 1 3
3 2 1
...

output:

1

result:

ok 1 number(s): "1"

Test #15:

score: 0
Accepted
time: 2923ms
memory: 287784kb

input:

10000
1 2 3
3 2 1
2 1 3
2 1 3
2 1 3
1 3 2
3 2 1
1 2 3
3 2 1
2 3 1
1 2 3
1 3 2
2 1 3
3 1 2
1 2 3
2 3 1
1 2 3
2 1 3
2 1 3
2 3 1
2 3 1
2 1 3
1 3 2
1 2 3
2 1 3
1 2 3
1 3 2
2 3 1
1 2 3
2 3 1
1 3 2
1 2 3
2 3 1
3 1 2
2 3 1
3 1 2
3 1 2
2 1 3
3 2 1
3 2 1
3 2 1
3 1 2
2 1 3
1 2 3
3 1 2
2 3 1
2 1 3
3 2 1
2 3 1
...

output:

2

result:

ok 1 number(s): "2"

Test #16:

score: 0
Accepted
time: 2954ms
memory: 285784kb

input:

10000
1 2 3
3 1 2
3 2 1
1 2 3
2 3 1
3 1 2
3 1 2
3 1 2
2 1 3
2 1 3
3 1 2
3 2 1
2 1 3
1 3 2
1 3 2
1 2 3
2 1 3
1 3 2
2 1 3
1 3 2
1 3 2
1 3 2
1 3 2
1 3 2
1 3 2
1 3 2
2 3 1
1 2 3
2 1 3
1 2 3
1 3 2
1 2 3
2 3 1
1 2 3
3 2 1
2 1 3
2 3 1
2 1 3
1 2 3
1 2 3
2 1 3
1 3 2
3 2 1
3 2 1
3 2 1
1 2 3
3 2 1
3 2 1
3 1 2
...

output:

2

result:

ok 1 number(s): "2"

Test #17:

score: 0
Accepted
time: 2852ms
memory: 285668kb

input:

10000
2 1 3
1 3 2
3 2 1
2 1 3
1 3 2
3 1 2
1 2 3
3 2 1
2 3 1
1 2 3
2 1 3
1 2 3
1 3 2
3 2 1
1 2 3
2 1 3
2 1 3
2 1 3
3 2 1
2 3 1
1 2 3
2 3 1
3 1 2
3 2 1
1 3 2
1 2 3
1 3 2
3 1 2
2 3 1
3 2 1
2 3 1
3 1 2
3 2 1
2 1 3
3 1 2
3 1 2
3 2 1
1 3 2
3 1 2
2 3 1
2 3 1
1 3 2
2 1 3
3 1 2
3 2 1
1 3 2
1 3 2
2 1 3
2 1 3
...

output:

1

result:

ok 1 number(s): "1"

Test #18:

score: 0
Accepted
time: 2894ms
memory: 286056kb

input:

10000
3 1 2
2 3 1
3 2 1
2 3 1
2 1 3
3 1 2
2 1 3
3 1 2
3 2 1
3 2 1
3 2 1
1 2 3
2 3 1
2 3 1
3 1 2
3 1 2
2 1 3
2 1 3
3 2 1
1 2 3
3 2 1
3 1 2
1 2 3
3 1 2
1 3 2
2 3 1
1 2 3
1 3 2
2 1 3
2 3 1
1 3 2
1 3 2
2 3 1
2 3 1
3 1 2
2 3 1
3 1 2
2 3 1
2 1 3
3 1 2
1 2 3
1 2 3
1 2 3
1 2 3
2 3 1
1 2 3
3 1 2
2 1 3
2 1 3
...

output:

1

result:

ok 1 number(s): "1"

Test #19:

score: 0
Accepted
time: 2964ms
memory: 287888kb

input:

10000
3 2 1
1 2 3
3 2 1
3 1 2
3 1 2
2 3 1
1 2 3
1 3 2
1 3 2
2 3 1
1 3 2
1 3 2
1 2 3
3 2 1
3 1 2
2 1 3
2 1 3
2 1 3
2 3 1
3 1 2
1 3 2
3 2 1
3 2 1
3 2 1
2 3 1
1 2 3
2 3 1
1 2 3
1 3 2
1 3 2
3 1 2
1 2 3
2 3 1
1 2 3
3 2 1
2 1 3
2 3 1
2 1 3
1 3 2
3 1 2
3 1 2
3 1 2
3 1 2
3 1 2
3 1 2
3 1 2
3 2 1
3 2 1
3 1 2
...

output:

3

result:

ok 1 number(s): "3"

Test #20:

score: 0
Accepted
time: 2887ms
memory: 285860kb

input:

10000
3 1 2
1 2 3
1 2 3
2 3 1
3 1 2
1 2 3
2 3 1
3 2 1
1 2 3
3 2 1
3 2 1
3 2 1
3 1 2
1 3 2
2 1 3
3 1 2
3 2 1
3 1 2
2 3 1
3 1 2
1 2 3
3 1 2
2 1 3
1 2 3
3 1 2
1 2 3
1 3 2
3 2 1
2 1 3
3 2 1
2 3 1
3 1 2
2 3 1
1 2 3
1 3 2
3 2 1
3 1 2
1 2 3
3 1 2
3 1 2
3 1 2
2 3 1
2 3 1
3 2 1
2 1 3
2 3 1
2 1 3
1 2 3
2 3 1
...

output:

3

result:

ok 1 number(s): "3"

Test #21:

score: 0
Accepted
time: 2993ms
memory: 285788kb

input:

10000
2 1 3
1 3 2
3 1 2
3 2 1
3 1 2
2 3 1
2 3 1
1 2 3
2 1 3
1 3 2
1 2 3
1 3 2
3 2 1
3 2 1
3 1 2
2 1 3
2 3 1
2 3 1
3 2 1
1 3 2
2 1 3
3 2 1
3 2 1
2 3 1
2 1 3
3 2 1
1 3 2
3 2 1
1 3 2
1 2 3
3 1 2
2 3 1
3 1 2
2 1 3
1 3 2
3 2 1
1 3 2
3 2 1
1 3 2
3 2 1
2 3 1
1 3 2
3 1 2
3 2 1
3 1 2
3 1 2
1 2 3
2 3 1
3 2 1
...

output:

1

result:

ok 1 number(s): "1"

Test #22:

score: 0
Accepted
time: 3044ms
memory: 287656kb

input:

10000
3 2 1
3 1 2
3 2 1
2 1 3
3 2 1
1 3 2
3 2 1
2 1 3
1 3 2
1 3 2
1 3 2
2 3 1
3 1 2
3 2 1
2 3 1
2 1 3
1 2 3
1 3 2
1 2 3
1 2 3
1 3 2
2 1 3
1 2 3
2 3 1
2 1 3
2 1 3
2 1 3
3 1 2
1 2 3
3 1 2
2 3 1
3 1 2
1 3 2
1 3 2
3 2 1
2 1 3
2 1 3
3 1 2
3 2 1
3 2 1
3 2 1
3 1 2
3 2 1
2 1 3
3 1 2
2 1 3
1 3 2
3 1 2
1 2 3
...

output:

1

result:

ok 1 number(s): "1"

Test #23:

score: 0
Accepted
time: 2961ms
memory: 285544kb

input:

10000
2 3 1
2 1 3
2 3 1
2 3 1
3 2 1
2 3 1
1 2 3
2 3 1
1 2 3
3 1 2
1 2 3
1 3 2
3 1 2
3 2 1
3 2 1
3 1 2
1 2 3
3 2 1
2 3 1
2 3 1
1 3 2
1 3 2
2 1 3
3 1 2
2 3 1
2 3 1
2 3 1
1 3 2
1 3 2
1 3 2
2 3 1
3 1 2
2 1 3
2 3 1
3 2 1
3 2 1
2 3 1
1 2 3
2 1 3
2 3 1
1 2 3
2 3 1
1 2 3
1 3 2
3 2 1
3 2 1
1 2 3
3 2 1
3 1 2
...

output:

1

result:

ok 1 number(s): "1"

Test #24:

score: 0
Accepted
time: 2896ms
memory: 285956kb

input:

10000
1 3 2
2 1 3
2 1 3
3 2 1
1 2 3
3 1 2
3 1 2
3 1 2
3 1 2
1 2 3
2 1 3
1 3 2
3 2 1
3 1 2
1 3 2
1 2 3
1 3 2
2 3 1
3 1 2
3 2 1
1 2 3
3 2 1
3 2 1
1 3 2
1 2 3
3 2 1
2 3 1
3 2 1
2 3 1
3 2 1
1 2 3
1 3 2
2 3 1
3 1 2
2 3 1
2 3 1
1 3 2
3 1 2
2 3 1
3 2 1
2 1 3
2 3 1
1 3 2
3 2 1
2 3 1
2 3 1
1 2 3
2 1 3
2 1 3
...

output:

3

result:

ok 1 number(s): "3"

Test #25:

score: 0
Accepted
time: 2954ms
memory: 287612kb

input:

10000
2 1 3
2 3 1
3 2 1
1 2 3
3 1 2
2 1 3
2 3 1
1 3 2
1 2 3
2 3 1
3 1 2
3 2 1
1 2 3
2 3 1
3 1 2
3 1 2
2 3 1
1 2 3
1 2 3
3 1 2
2 3 1
2 1 3
1 3 2
1 3 2
2 3 1
1 2 3
2 3 1
2 1 3
3 2 1
1 2 3
1 2 3
1 2 3
1 3 2
2 1 3
1 2 3
1 3 2
1 2 3
1 2 3
3 2 1
2 1 3
2 1 3
1 3 2
1 3 2
1 2 3
3 2 1
2 1 3
3 1 2
1 3 2
1 3 2
...

output:

1

result:

ok 1 number(s): "1"

Test #26:

score: 0
Accepted
time: 2999ms
memory: 287416kb

input:

10000
2 1 3
3 1 2
1 2 3
2 1 3
3 1 2
1 3 2
2 1 3
3 2 1
3 1 2
1 3 2
1 3 2
3 2 1
2 1 3
1 2 3
3 1 2
1 2 3
2 1 3
1 3 2
1 2 3
2 3 1
3 1 2
2 1 3
2 3 1
2 1 3
2 3 1
3 2 1
2 3 1
1 3 2
1 2 3
3 1 2
2 3 1
1 2 3
1 3 2
3 2 1
3 1 2
2 1 3
3 2 1
1 2 3
1 3 2
2 3 1
3 1 2
1 2 3
3 1 2
1 3 2
3 1 2
2 1 3
2 1 3
1 3 2
2 3 1
...

output:

3

result:

ok 1 number(s): "3"

Test #27:

score: 0
Accepted
time: 2925ms
memory: 285856kb

input:

10000
3 2 1
2 1 3
1 2 3
1 3 2
3 2 1
3 2 1
1 3 2
3 1 2
1 3 2
3 2 1
1 3 2
1 3 2
3 2 1
1 2 3
3 2 1
1 3 2
3 2 1
3 2 1
2 1 3
2 3 1
3 2 1
3 1 2
1 3 2
3 2 1
3 2 1
3 1 2
1 2 3
2 3 1
3 2 1
3 1 2
1 3 2
3 2 1
1 3 2
1 3 2
3 1 2
3 2 1
2 1 3
1 3 2
3 2 1
2 3 1
1 2 3
1 3 2
2 1 3
1 3 2
1 2 3
2 1 3
2 1 3
3 2 1
3 2 1
...

output:

2

result:

ok 1 number(s): "2"

Test #28:

score: 0
Accepted
time: 2918ms
memory: 286020kb

input:

10000
1 3 2
1 3 2
2 3 1
2 3 1
1 3 2
2 1 3
2 1 3
2 1 3
3 1 2
2 1 3
2 3 1
3 2 1
3 2 1
3 1 2
1 3 2
1 3 2
2 1 3
3 2 1
1 3 2
2 1 3
3 1 2
1 2 3
2 1 3
1 3 2
2 1 3
3 1 2
2 3 1
1 2 3
3 2 1
3 2 1
1 3 2
1 2 3
3 2 1
1 2 3
1 3 2
3 1 2
2 1 3
2 1 3
3 2 1
1 2 3
3 2 1
2 3 1
2 3 1
1 3 2
3 1 2
1 3 2
3 2 1
2 3 1
1 3 2
...

output:

3

result:

ok 1 number(s): "3"

Test #29:

score: 0
Accepted
time: 2945ms
memory: 285856kb

input:

10000
2 1 3
3 1 2
3 1 2
1 2 3
1 3 2
3 1 2
2 3 1
2 3 1
1 3 2
1 2 3
3 2 1
3 2 1
1 2 3
2 3 1
2 3 1
3 2 1
3 2 1
3 2 1
3 2 1
3 1 2
3 1 2
2 3 1
3 1 2
3 1 2
1 2 3
3 1 2
3 2 1
3 1 2
1 2 3
1 3 2
1 3 2
2 3 1
1 3 2
2 3 1
2 3 1
2 3 1
1 3 2
2 1 3
1 3 2
3 1 2
3 1 2
1 3 2
1 2 3
1 3 2
1 2 3
3 1 2
3 2 1
3 2 1
3 2 1
...

output:

2

result:

ok 1 number(s): "2"

Test #30:

score: 0
Accepted
time: 3035ms
memory: 287504kb

input:

10000
1 2 3
2 3 1
2 3 1
1 2 3
2 3 1
1 2 3
3 1 2
3 2 1
1 3 2
2 1 3
2 1 3
1 2 3
2 3 1
3 1 2
1 2 3
3 1 2
1 3 2
1 3 2
1 3 2
2 3 1
1 3 2
1 3 2
1 2 3
3 2 1
3 1 2
3 2 1
1 3 2
2 3 1
3 1 2
1 3 2
1 3 2
2 1 3
3 1 2
2 1 3
2 3 1
3 1 2
2 3 1
3 2 1
1 3 2
3 1 2
3 1 2
3 1 2
3 1 2
2 1 3
2 3 1
2 1 3
1 3 2
3 2 1
2 1 3
...

output:

1

result:

ok 1 number(s): "1"

Test #31:

score: 0
Accepted
time: 3002ms
memory: 287680kb

input:

10000
3 1 2
3 2 1
2 3 1
2 1 3
3 2 1
1 2 3
2 3 1
2 3 1
2 1 3
2 1 3
3 1 2
2 1 3
2 1 3
2 3 1
1 3 2
3 1 2
2 1 3
1 2 3
2 1 3
2 1 3
1 2 3
3 1 2
2 1 3
2 1 3
2 3 1
1 2 3
1 3 2
1 3 2
2 3 1
1 3 2
2 3 1
3 1 2
3 2 1
2 3 1
2 1 3
2 3 1
2 1 3
2 1 3
2 1 3
2 1 3
1 3 2
2 3 1
3 2 1
3 1 2
3 2 1
3 1 2
3 2 1
2 3 1
2 1 3
...

output:

2

result:

ok 1 number(s): "2"

Test #32:

score: 0
Accepted
time: 23ms
memory: 29096kb

input:

1000
1 2 3
2 3 1
1 3 2
3 1 2
2 1 3
1 2 3
3 2 1
1 2 3
1 2 3
3 2 1
3 2 1
3 1 2
2 3 1
1 2 3
2 1 3
3 2 1
3 2 1
1 3 2
1 3 2
3 2 1
3 2 1
3 1 2
1 2 3
1 3 2
1 3 2
1 2 3
3 1 2
1 3 2
3 2 1
1 3 2
2 1 3
3 1 2
2 3 1
2 1 3
2 3 1
3 1 2
3 1 2
2 1 3
3 1 2
1 2 3
1 2 3
2 3 1
2 1 3
2 1 3
1 3 2
3 1 2
2 3 1
1 3 2
3 1 2
1...

output:

2

result:

ok 1 number(s): "2"

Test #33:

score: 0
Accepted
time: 19ms
memory: 29040kb

input:

1000
2 3 1
3 2 1
2 1 3
1 3 2
1 2 3
1 3 2
1 3 2
3 2 1
3 2 1
2 3 1
2 3 1
3 2 1
2 1 3
3 2 1
3 1 2
3 2 1
2 1 3
1 3 2
3 1 2
3 1 2
1 3 2
2 1 3
1 2 3
1 3 2
1 2 3
2 1 3
1 3 2
3 1 2
1 2 3
3 2 1
1 3 2
3 1 2
2 1 3
1 2 3
3 2 1
3 2 1
1 2 3
2 3 1
2 3 1
3 2 1
1 3 2
3 2 1
2 3 1
2 3 1
3 1 2
3 2 1
3 1 2
1 2 3
1 3 2
3...

output:

1

result:

ok 1 number(s): "1"

Test #34:

score: 0
Accepted
time: 23ms
memory: 29092kb

input:

1000
2 1 3
2 3 1
3 2 1
2 1 3
2 3 1
1 2 3
3 2 1
3 1 2
2 3 1
2 3 1
3 2 1
1 2 3
1 2 3
2 3 1
1 3 2
2 1 3
1 2 3
3 2 1
3 1 2
1 2 3
2 3 1
2 3 1
1 2 3
3 2 1
3 1 2
1 2 3
1 2 3
1 3 2
3 2 1
3 2 1
3 2 1
1 3 2
3 1 2
2 1 3
1 2 3
2 1 3
2 3 1
1 2 3
2 3 1
2 3 1
3 1 2
2 3 1
2 3 1
3 2 1
3 1 2
2 1 3
3 2 1
1 2 3
1 2 3
1...

output:

2

result:

ok 1 number(s): "2"

Test #35:

score: 0
Accepted
time: 21ms
memory: 27020kb

input:

1000
3 2 1
1 2 3
3 2 1
2 3 1
2 3 1
2 3 1
3 2 1
2 3 1
3 1 2
2 1 3
2 3 1
2 1 3
2 1 3
3 2 1
3 2 1
3 2 1
1 2 3
1 3 2
3 1 2
2 3 1
2 1 3
1 2 3
3 2 1
1 2 3
1 2 3
3 2 1
1 3 2
2 1 3
3 2 1
1 2 3
1 2 3
2 3 1
1 3 2
2 3 1
3 2 1
3 2 1
2 1 3
2 1 3
3 2 1
1 2 3
3 1 2
2 3 1
3 2 1
2 3 1
3 1 2
1 2 3
3 1 2
2 1 3
1 2 3
1...

output:

1

result:

ok 1 number(s): "1"

Test #36:

score: 0
Accepted
time: 23ms
memory: 27056kb

input:

1000
1 3 2
3 2 1
3 2 1
3 1 2
1 2 3
1 3 2
3 2 1
3 1 2
3 1 2
2 3 1
1 3 2
1 3 2
3 2 1
3 1 2
1 2 3
1 3 2
1 2 3
2 3 1
1 3 2
3 2 1
2 1 3
2 1 3
2 1 3
1 3 2
1 3 2
3 1 2
3 1 2
2 1 3
3 1 2
3 1 2
2 1 3
2 3 1
1 2 3
2 3 1
1 3 2
3 1 2
3 2 1
3 1 2
3 1 2
3 2 1
1 2 3
1 2 3
2 3 1
3 1 2
2 3 1
1 2 3
1 2 3
1 3 2
3 1 2
3...

output:

2

result:

ok 1 number(s): "2"

Test #37:

score: 0
Accepted
time: 22ms
memory: 29084kb

input:

1000
1 3 2
3 1 2
2 1 3
3 2 1
2 1 3
1 2 3
3 2 1
1 2 3
3 2 1
3 2 1
1 2 3
3 1 2
3 1 2
2 3 1
1 2 3
1 3 2
3 1 2
3 2 1
1 2 3
3 2 1
2 3 1
3 2 1
2 1 3
1 3 2
1 3 2
3 2 1
1 2 3
3 1 2
1 2 3
2 3 1
2 3 1
1 3 2
3 1 2
2 3 1
2 3 1
1 2 3
3 2 1
2 3 1
2 1 3
1 3 2
3 2 1
3 1 2
1 2 3
1 2 3
3 1 2
3 1 2
1 3 2
3 2 1
3 1 2
2...

output:

3

result:

ok 1 number(s): "3"

Test #38:

score: 0
Accepted
time: 19ms
memory: 29328kb

input:

1000
1 2 3
1 3 2
2 1 3
2 3 1
3 2 1
2 3 1
2 1 3
1 2 3
2 1 3
2 3 1
1 3 2
2 1 3
2 1 3
1 2 3
3 2 1
2 1 3
3 2 1
1 2 3
1 3 2
3 1 2
2 1 3
2 1 3
3 2 1
2 1 3
3 1 2
3 2 1
3 1 2
1 3 2
2 1 3
1 2 3
1 3 2
2 3 1
1 3 2
2 3 1
2 3 1
3 1 2
2 3 1
1 2 3
2 3 1
2 3 1
1 3 2
1 3 2
2 3 1
3 1 2
1 3 2
1 2 3
2 1 3
3 2 1
2 3 1
2...

output:

2

result:

ok 1 number(s): "2"

Test #39:

score: 0
Accepted
time: 19ms
memory: 27044kb

input:

1000
1 2 3
1 3 2
1 2 3
2 1 3
1 2 3
2 3 1
1 3 2
2 3 1
3 2 1
3 1 2
3 1 2
3 2 1
1 2 3
1 3 2
3 2 1
1 3 2
3 1 2
3 1 2
3 2 1
3 1 2
2 3 1
2 1 3
3 2 1
2 1 3
2 1 3
3 2 1
3 1 2
2 3 1
1 3 2
3 1 2
1 2 3
1 2 3
1 3 2
2 1 3
1 3 2
1 2 3
1 3 2
2 1 3
3 2 1
3 2 1
1 3 2
1 2 3
3 2 1
3 2 1
2 1 3
1 3 2
3 1 2
1 3 2
3 1 2
1...

output:

3

result:

ok 1 number(s): "3"

Test #40:

score: 0
Accepted
time: 23ms
memory: 27276kb

input:

1000
1 2 3
2 3 1
1 2 3
1 3 2
1 3 2
2 1 3
1 3 2
2 1 3
2 3 1
1 3 2
3 1 2
2 1 3
1 2 3
3 2 1
1 3 2
1 3 2
3 1 2
3 2 1
2 1 3
3 2 1
1 2 3
2 1 3
3 2 1
1 2 3
2 1 3
1 2 3
3 1 2
2 1 3
1 3 2
1 2 3
2 3 1
3 1 2
2 3 1
3 1 2
1 3 2
2 3 1
3 1 2
2 1 3
1 3 2
2 3 1
2 1 3
1 3 2
3 2 1
2 3 1
1 2 3
2 3 1
1 3 2
1 2 3
3 2 1
3...

output:

3

result:

ok 1 number(s): "3"

Test #41:

score: 0
Accepted
time: 23ms
memory: 29088kb

input:

1000
1 2 3
3 1 2
2 3 1
3 2 1
3 2 1
2 3 1
3 2 1
1 2 3
2 1 3
2 1 3
3 1 2
2 1 3
2 3 1
3 2 1
2 1 3
1 3 2
3 2 1
2 3 1
2 3 1
1 2 3
3 1 2
2 3 1
3 2 1
2 3 1
3 2 1
1 2 3
3 2 1
2 1 3
1 2 3
1 3 2
2 1 3
1 3 2
2 1 3
1 2 3
1 3 2
3 2 1
2 3 1
2 3 1
1 2 3
1 3 2
1 3 2
1 2 3
2 3 1
1 2 3
2 3 1
2 3 1
2 1 3
1 3 2
2 1 3
2...

output:

1

result:

ok 1 number(s): "1"

Test #42:

score: 0
Accepted
time: 25ms
memory: 27056kb

input:

1000
1 3 2
1 3 2
2 3 1
2 3 1
1 3 2
2 1 3
1 2 3
3 2 1
2 1 3
3 1 2
3 1 2
1 3 2
2 1 3
1 3 2
2 3 1
1 3 2
1 3 2
1 2 3
2 3 1
3 2 1
1 2 3
3 1 2
1 2 3
1 3 2
3 2 1
2 1 3
1 2 3
3 2 1
3 1 2
2 1 3
2 3 1
3 1 2
2 3 1
1 3 2
1 3 2
3 2 1
1 2 3
1 3 2
1 2 3
1 2 3
2 1 3
3 1 2
2 1 3
3 2 1
2 1 3
2 3 1
3 2 1
2 1 3
2 3 1
1...

output:

1

result:

ok 1 number(s): "1"

Test #43:

score: 0
Accepted
time: 25ms
memory: 26980kb

input:

1000
3 1 2
1 3 2
1 3 2
1 3 2
3 2 1
1 2 3
1 3 2
1 2 3
3 2 1
1 3 2
3 2 1
2 3 1
2 3 1
3 1 2
3 1 2
2 3 1
3 2 1
1 2 3
3 2 1
1 2 3
3 2 1
1 3 2
3 2 1
3 2 1
3 1 2
2 1 3
2 1 3
2 3 1
3 1 2
2 1 3
3 1 2
1 2 3
1 3 2
1 3 2
2 3 1
3 2 1
3 1 2
2 3 1
3 2 1
3 1 2
2 1 3
1 3 2
1 3 2
2 1 3
3 1 2
3 2 1
3 2 1
1 3 2
1 2 3
1...

output:

3

result:

ok 1 number(s): "3"

Test #44:

score: 0
Accepted
time: 19ms
memory: 27016kb

input:

1000
1 3 2
1 2 3
2 3 1
1 2 3
3 2 1
3 1 2
3 1 2
1 3 2
2 1 3
1 3 2
1 2 3
3 1 2
1 3 2
1 2 3
3 2 1
1 2 3
1 2 3
3 1 2
2 1 3
3 2 1
3 1 2
3 1 2
3 1 2
3 2 1
3 2 1
2 1 3
2 1 3
1 3 2
3 1 2
1 3 2
2 1 3
3 1 2
1 3 2
3 2 1
3 1 2
1 2 3
2 1 3
2 3 1
2 3 1
1 2 3
3 2 1
2 1 3
1 2 3
3 1 2
2 3 1
3 1 2
2 3 1
2 1 3
3 2 1
2...

output:

2

result:

ok 1 number(s): "2"

Test #45:

score: 0
Accepted
time: 22ms
memory: 27040kb

input:

1000
2 3 1
3 2 1
1 3 2
1 2 3
1 3 2
3 1 2
1 2 3
1 3 2
3 1 2
3 2 1
3 2 1
3 2 1
1 2 3
3 1 2
3 1 2
3 1 2
1 3 2
1 2 3
2 3 1
3 2 1
2 1 3
2 1 3
3 2 1
1 3 2
3 1 2
2 1 3
1 3 2
3 1 2
3 2 1
3 2 1
2 3 1
1 3 2
2 1 3
3 1 2
2 3 1
1 2 3
2 3 1
3 1 2
3 2 1
2 1 3
2 1 3
3 1 2
3 2 1
2 1 3
2 1 3
2 1 3
1 3 2
2 1 3
1 2 3
3...

output:

3

result:

ok 1 number(s): "3"

Test #46:

score: 0
Accepted
time: 20ms
memory: 29292kb

input:

1000
2 1 3
3 1 2
2 3 1
2 3 1
3 1 2
2 1 3
1 3 2
2 1 3
1 3 2
2 3 1
2 1 3
1 2 3
3 1 2
2 1 3
3 2 1
2 1 3
3 2 1
1 2 3
2 1 3
1 3 2
1 3 2
3 1 2
3 1 2
1 3 2
2 3 1
2 1 3
3 2 1
3 1 2
1 3 2
2 1 3
2 3 1
1 2 3
2 3 1
1 2 3
2 3 1
1 2 3
1 2 3
2 1 3
1 3 2
1 2 3
3 2 1
3 1 2
1 2 3
2 1 3
1 2 3
3 2 1
2 1 3
1 3 2
1 3 2
3...

output:

2

result:

ok 1 number(s): "2"

Test #47:

score: 0
Accepted
time: 23ms
memory: 26988kb

input:

1000
3 1 2
3 2 1
2 3 1
3 1 2
3 1 2
1 3 2
3 1 2
2 3 1
3 2 1
3 1 2
1 2 3
3 1 2
2 3 1
1 3 2
3 1 2
1 3 2
1 2 3
1 3 2
2 3 1
2 1 3
3 1 2
2 1 3
3 1 2
2 1 3
2 3 1
1 2 3
2 3 1
2 1 3
3 1 2
2 1 3
1 2 3
1 2 3
3 2 1
2 1 3
2 3 1
1 2 3
1 3 2
3 2 1
1 2 3
1 2 3
2 1 3
3 2 1
2 3 1
2 1 3
2 3 1
2 1 3
1 3 2
2 3 1
3 1 2
3...

output:

2

result:

ok 1 number(s): "2"

Test #48:

score: 0
Accepted
time: 18ms
memory: 26980kb

input:

1000
2 3 1
2 3 1
3 2 1
3 1 2
3 2 1
1 3 2
1 3 2
2 3 1
1 3 2
1 2 3
3 1 2
3 2 1
1 2 3
1 3 2
2 1 3
3 2 1
1 2 3
3 1 2
1 2 3
2 3 1
2 3 1
1 3 2
1 3 2
2 3 1
3 2 1
2 3 1
3 1 2
3 2 1
2 1 3
3 1 2
3 1 2
1 2 3
3 1 2
1 2 3
3 1 2
2 1 3
1 2 3
2 1 3
2 1 3
1 2 3
1 3 2
3 1 2
2 1 3
3 1 2
1 3 2
1 3 2
1 3 2
1 3 2
1 2 3
2...

output:

2

result:

ok 1 number(s): "2"

Test #49:

score: 0
Accepted
time: 22ms
memory: 27056kb

input:

1000
3 1 2
1 2 3
2 1 3
1 3 2
3 2 1
1 3 2
2 3 1
3 1 2
3 1 2
2 1 3
1 3 2
3 2 1
2 3 1
3 2 1
2 1 3
2 3 1
3 1 2
2 3 1
1 2 3
3 2 1
1 3 2
3 2 1
3 2 1
3 1 2
1 3 2
3 2 1
1 3 2
2 3 1
2 1 3
3 1 2
2 3 1
2 3 1
2 3 1
2 1 3
3 1 2
2 1 3
2 1 3
3 2 1
2 1 3
3 2 1
1 2 3
3 2 1
2 3 1
3 2 1
2 3 1
3 2 1
3 2 1
3 1 2
3 1 2
3...

output:

1

result:

ok 1 number(s): "1"

Test #50:

score: 0
Accepted
time: 23ms
memory: 27212kb

input:

1000
1 3 2
3 2 1
2 1 3
3 1 2
3 2 1
1 2 3
1 3 2
3 1 2
3 1 2
1 2 3
2 1 3
1 3 2
1 3 2
1 3 2
1 3 2
1 3 2
3 1 2
3 2 1
2 1 3
1 3 2
2 1 3
2 3 1
3 1 2
3 2 1
3 1 2
1 3 2
1 2 3
1 2 3
2 1 3
1 3 2
3 2 1
2 3 1
3 2 1
1 3 2
1 3 2
2 3 1
2 3 1
2 3 1
2 3 1
1 3 2
3 1 2
2 3 1
1 2 3
3 2 1
1 3 2
2 3 1
2 3 1
3 2 1
2 3 1
1...

output:

1

result:

ok 1 number(s): "1"

Test #51:

score: 0
Accepted
time: 24ms
memory: 29028kb

input:

1000
2 3 1
2 1 3
1 2 3
2 3 1
2 3 1
1 3 2
3 2 1
1 3 2
2 1 3
1 2 3
2 1 3
1 3 2
2 1 3
3 2 1
2 3 1
1 3 2
3 1 2
2 3 1
1 2 3
3 2 1
2 3 1
1 3 2
2 3 1
1 2 3
3 2 1
3 1 2
3 1 2
2 1 3
1 3 2
1 2 3
2 3 1
1 2 3
1 3 2
2 1 3
3 1 2
3 2 1
1 3 2
2 3 1
1 2 3
2 1 3
1 3 2
3 1 2
3 2 1
3 1 2
1 3 2
3 1 2
3 2 1
3 1 2
3 1 2
3...

output:

1

result:

ok 1 number(s): "1"

Test #52:

score: 0
Accepted
time: 2964ms
memory: 287812kb

input:

10000
1 3 2
3 2 1
1 2 3
2 3 1
1 2 3
2 3 1
1 2 3
3 1 2
1 2 3
1 3 2
2 1 3
2 1 3
1 3 2
3 1 2
2 3 1
3 1 2
2 1 3
2 1 3
3 1 2
3 1 2
2 1 3
1 2 3
2 1 3
3 1 2
3 1 2
3 2 1
1 3 2
1 3 2
3 2 1
3 2 1
2 3 1
3 1 2
1 3 2
3 2 1
3 1 2
2 3 1
2 3 1
2 3 1
3 1 2
1 3 2
2 1 3
1 3 2
2 3 1
2 3 1
3 1 2
3 1 2
3 2 1
2 3 1
1 2 3
...

output:

1

result:

ok 1 number(s): "1"

Test #53:

score: 0
Accepted
time: 2959ms
memory: 285980kb

input:

10000
1 2 3
1 2 3
2 1 3
1 3 2
2 3 1
2 1 3
1 2 3
3 2 1
3 2 1
2 1 3
3 2 1
2 3 1
3 2 1
2 1 3
1 2 3
3 1 2
2 1 3
1 2 3
1 3 2
3 2 1
1 3 2
2 3 1
3 2 1
2 1 3
3 1 2
2 1 3
3 2 1
3 2 1
1 3 2
1 3 2
1 3 2
3 2 1
1 3 2
3 1 2
2 3 1
1 2 3
1 3 2
2 3 1
1 2 3
1 2 3
2 1 3
2 3 1
1 3 2
2 1 3
2 3 1
1 2 3
3 2 1
3 2 1
3 1 2
...

output:

2

result:

ok 1 number(s): "2"

Test #54:

score: 0
Accepted
time: 2974ms
memory: 287492kb

input:

10000
3 2 1
2 1 3
1 3 2
2 3 1
2 3 1
1 2 3
1 2 3
3 1 2
1 2 3
1 3 2
1 2 3
1 3 2
3 2 1
2 3 1
3 2 1
3 2 1
3 2 1
1 3 2
3 1 2
2 3 1
1 3 2
2 1 3
3 1 2
2 1 3
1 2 3
2 3 1
3 2 1
3 1 2
3 1 2
3 1 2
3 2 1
2 3 1
3 2 1
3 1 2
3 2 1
2 1 3
1 3 2
2 1 3
3 2 1
1 3 2
2 3 1
3 1 2
2 1 3
3 1 2
2 3 1
2 1 3
3 1 2
2 3 1
2 1 3
...

output:

1

result:

ok 1 number(s): "1"

Test #55:

score: 0
Accepted
time: 2959ms
memory: 285964kb

input:

10000
1 3 2
2 1 3
2 1 3
3 2 1
1 3 2
2 3 1
2 1 3
2 1 3
1 2 3
3 2 1
2 3 1
1 3 2
1 3 2
1 3 2
2 1 3
3 2 1
1 2 3
2 3 1
2 1 3
3 2 1
1 3 2
1 2 3
1 2 3
1 3 2
3 1 2
3 2 1
2 1 3
3 1 2
3 2 1
1 2 3
2 3 1
3 2 1
1 2 3
2 1 3
3 1 2
3 1 2
1 3 2
3 1 2
3 1 2
1 3 2
3 2 1
3 2 1
3 1 2
2 1 3
2 3 1
1 3 2
3 1 2
1 2 3
1 3 2
...

output:

3

result:

ok 1 number(s): "3"

Test #56:

score: 0
Accepted
time: 2931ms
memory: 285764kb

input:

10000
3 1 2
2 1 3
2 3 1
1 3 2
2 3 1
1 2 3
3 1 2
1 3 2
2 3 1
2 3 1
1 2 3
2 3 1
1 2 3
3 2 1
1 2 3
1 3 2
2 1 3
1 2 3
2 3 1
2 3 1
1 2 3
2 3 1
1 2 3
1 3 2
1 2 3
3 2 1
3 1 2
1 3 2
3 2 1
3 1 2
2 1 3
2 3 1
2 3 1
1 2 3
1 3 2
2 1 3
1 3 2
3 1 2
1 3 2
2 3 1
1 2 3
1 2 3
3 2 1
1 2 3
3 1 2
1 2 3
3 2 1
3 1 2
3 1 2
...

output:

2

result:

ok 1 number(s): "2"

Test #57:

score: 0
Accepted
time: 3013ms
memory: 285772kb

input:

10000
3 1 2
2 3 1
2 3 1
1 3 2
2 3 1
2 3 1
2 1 3
3 1 2
3 1 2
2 3 1
2 3 1
3 1 2
2 3 1
1 2 3
1 3 2
1 2 3
1 2 3
3 2 1
1 3 2
3 2 1
1 2 3
1 2 3
1 2 3
1 2 3
3 1 2
2 3 1
1 3 2
1 2 3
1 2 3
2 3 1
1 3 2
1 2 3
3 1 2
3 1 2
1 3 2
2 1 3
3 2 1
3 2 1
1 2 3
3 1 2
2 1 3
1 3 2
1 2 3
2 1 3
2 1 3
2 1 3
1 3 2
3 2 1
1 2 3
...

output:

1

result:

ok 1 number(s): "1"

Test #58:

score: 0
Accepted
time: 2936ms
memory: 287556kb

input:

10000
3 2 1
2 1 3
1 3 2
3 1 2
1 3 2
3 1 2
1 3 2
1 2 3
3 1 2
2 3 1
3 2 1
2 3 1
1 2 3
1 3 2
2 1 3
2 3 1
3 2 1
2 1 3
1 2 3
2 1 3
1 3 2
3 1 2
1 3 2
1 2 3
2 3 1
3 1 2
2 3 1
1 2 3
1 3 2
3 2 1
1 3 2
1 3 2
2 3 1
3 1 2
1 2 3
3 1 2
3 2 1
2 3 1
3 1 2
2 1 3
3 2 1
2 3 1
3 1 2
2 1 3
2 1 3
1 3 2
3 2 1
2 1 3
3 1 2
...

output:

1

result:

ok 1 number(s): "1"

Test #59:

score: 0
Accepted
time: 2997ms
memory: 285792kb

input:

10000
2 1 3
2 3 1
1 3 2
2 3 1
2 3 1
2 3 1
3 2 1
3 1 2
1 3 2
3 2 1
3 1 2
1 3 2
3 2 1
1 3 2
1 2 3
2 3 1
1 3 2
2 1 3
2 1 3
1 3 2
3 1 2
3 1 2
2 1 3
1 2 3
3 2 1
1 2 3
2 1 3
3 1 2
1 3 2
2 1 3
3 1 2
1 3 2
3 1 2
1 3 2
2 3 1
2 1 3
2 1 3
1 2 3
3 2 1
2 1 3
2 1 3
1 2 3
3 2 1
1 2 3
3 2 1
1 3 2
1 2 3
3 1 2
1 3 2
...

output:

2

result:

ok 1 number(s): "2"

Test #60:

score: 0
Accepted
time: 2938ms
memory: 285652kb

input:

10000
2 1 3
1 2 3
1 3 2
2 1 3
2 1 3
1 2 3
3 2 1
2 1 3
2 3 1
2 3 1
2 1 3
1 2 3
2 3 1
2 1 3
3 1 2
1 2 3
2 1 3
2 3 1
1 3 2
1 2 3
2 3 1
3 1 2
1 2 3
2 1 3
1 3 2
3 2 1
3 1 2
1 2 3
2 1 3
2 3 1
2 3 1
3 2 1
2 3 1
1 3 2
2 3 1
3 1 2
2 1 3
1 2 3
3 1 2
3 2 1
3 1 2
1 3 2
2 1 3
3 1 2
1 3 2
3 1 2
3 1 2
2 1 3
2 3 1
...

output:

3

result:

ok 1 number(s): "3"

Test #61:

score: 0
Accepted
time: 2967ms
memory: 285684kb

input:

10000
1 2 3
1 3 2
2 1 3
1 3 2
1 3 2
2 3 1
1 2 3
1 3 2
1 3 2
2 3 1
1 3 2
2 3 1
3 1 2
3 2 1
1 3 2
3 1 2
2 1 3
2 3 1
2 3 1
3 2 1
3 2 1
2 3 1
3 1 2
1 2 3
1 3 2
2 3 1
3 2 1
1 3 2
3 2 1
1 2 3
2 1 3
2 3 1
1 3 2
1 2 3
1 3 2
2 1 3
2 3 1
3 1 2
2 1 3
1 2 3
2 1 3
2 3 1
2 1 3
1 2 3
2 3 1
3 2 1
2 3 1
2 1 3
3 2 1
...

output:

1

result:

ok 1 number(s): "1"

Test #62:

score: 0
Accepted
time: 2960ms
memory: 287560kb

input:

10000
1 2 3
3 1 2
3 1 2
2 1 3
1 3 2
2 1 3
2 1 3
3 1 2
1 2 3
3 2 1
2 1 3
2 1 3
1 2 3
1 3 2
1 3 2
1 3 2
1 3 2
1 3 2
1 2 3
1 3 2
2 3 1
3 2 1
2 3 1
2 3 1
2 1 3
1 2 3
2 3 1
1 3 2
1 3 2
1 3 2
1 2 3
2 1 3
3 2 1
1 3 2
2 1 3
3 1 2
3 1 2
3 1 2
2 3 1
2 3 1
3 2 1
1 3 2
1 2 3
2 3 1
2 1 3
3 2 1
1 3 2
3 2 1
3 2 1
...

output:

2

result:

ok 1 number(s): "2"

Test #63:

score: 0
Accepted
time: 3035ms
memory: 287612kb

input:

10000
2 1 3
3 1 2
3 2 1
1 2 3
3 1 2
1 2 3
2 1 3
3 1 2
3 1 2
1 2 3
2 1 3
1 2 3
2 3 1
1 3 2
1 2 3
3 1 2
3 2 1
3 2 1
2 3 1
3 2 1
2 1 3
2 1 3
3 1 2
1 3 2
2 3 1
2 1 3
1 3 2
2 3 1
2 3 1
2 1 3
3 2 1
1 2 3
1 3 2
2 3 1
1 3 2
2 3 1
2 1 3
3 2 1
3 1 2
2 3 1
3 2 1
2 3 1
3 1 2
2 1 3
2 1 3
3 1 2
3 2 1
3 2 1
1 2 3
...

output:

2

result:

ok 1 number(s): "2"

Test #64:

score: 0
Accepted
time: 2940ms
memory: 285592kb

input:

10000
2 3 1
3 2 1
1 2 3
2 3 1
1 2 3
1 2 3
3 1 2
1 3 2
2 3 1
1 2 3
1 3 2
3 2 1
3 2 1
3 2 1
3 1 2
1 3 2
2 3 1
1 2 3
1 2 3
3 2 1
2 1 3
2 3 1
1 2 3
3 2 1
2 3 1
3 1 2
3 1 2
2 1 3
1 3 2
1 2 3
1 3 2
1 3 2
3 1 2
3 1 2
2 1 3
3 1 2
1 3 2
2 1 3
3 1 2
2 3 1
2 3 1
2 3 1
2 3 1
2 3 1
1 3 2
2 3 1
1 3 2
2 1 3
1 3 2
...

output:

1

result:

ok 1 number(s): "1"

Test #65:

score: 0
Accepted
time: 2913ms
memory: 288000kb

input:

10000
2 1 3
1 3 2
2 3 1
3 1 2
3 2 1
1 3 2
1 3 2
2 1 3
3 2 1
3 1 2
2 3 1
2 3 1
1 3 2
2 3 1
2 3 1
3 2 1
3 2 1
2 3 1
2 3 1
2 3 1
2 1 3
3 2 1
3 1 2
1 2 3
2 1 3
2 1 3
1 2 3
2 1 3
1 3 2
1 3 2
1 3 2
2 1 3
2 1 3
2 3 1
1 3 2
2 3 1
3 2 1
1 3 2
3 1 2
1 2 3
1 2 3
1 2 3
3 1 2
3 1 2
1 2 3
2 3 1
2 1 3
3 2 1
1 2 3
...

output:

1

result:

ok 1 number(s): "1"

Test #66:

score: 0
Accepted
time: 2949ms
memory: 286132kb

input:

10000
1 2 3
2 3 1
1 3 2
3 1 2
2 1 3
1 2 3
3 2 1
1 2 3
1 2 3
3 2 1
3 2 1
3 1 2
2 3 1
1 2 3
2 1 3
3 2 1
3 2 1
1 3 2
1 3 2
3 2 1
3 2 1
3 1 2
1 2 3
1 3 2
1 3 2
1 2 3
3 1 2
1 3 2
3 2 1
1 3 2
2 1 3
3 1 2
2 3 1
2 1 3
2 3 1
3 1 2
3 1 2
2 1 3
3 1 2
1 2 3
1 2 3
2 3 1
2 1 3
2 1 3
1 3 2
3 1 2
2 3 1
1 3 2
3 1 2
...

output:

2

result:

ok 1 number(s): "2"

Test #67:

score: 0
Accepted
time: 2849ms
memory: 287824kb

input:

10000
1 3 2
1 3 2
2 3 1
1 2 3
3 1 2
3 1 2
3 2 1
1 3 2
3 1 2
2 1 3
1 2 3
2 3 1
2 1 3
1 3 2
2 3 1
2 1 3
3 1 2
3 1 2
1 2 3
2 3 1
2 3 1
3 1 2
2 3 1
3 2 1
3 1 2
2 1 3
3 1 2
3 1 2
2 3 1
3 1 2
1 3 2
3 2 1
3 1 2
1 2 3
2 3 1
3 2 1
1 3 2
2 1 3
1 2 3
2 1 3
1 2 3
3 2 1
3 2 1
1 3 2
1 3 2
2 1 3
1 3 2
3 1 2
1 2 3
...

output:

1

result:

ok 1 number(s): "1"

Test #68:

score: 0
Accepted
time: 3037ms
memory: 285956kb

input:

10000
3 1 2
2 1 3
3 1 2
1 3 2
3 1 2
1 3 2
2 3 1
2 3 1
2 3 1
2 3 1
2 1 3
2 3 1
2 1 3
1 3 2
3 1 2
2 3 1
3 1 2
1 2 3
2 3 1
3 1 2
1 2 3
1 3 2
2 1 3
1 3 2
2 1 3
2 3 1
2 3 1
3 2 1
1 2 3
1 3 2
3 2 1
3 2 1
2 1 3
1 2 3
2 3 1
1 3 2
3 1 2
1 3 2
1 3 2
3 2 1
1 3 2
2 1 3
1 3 2
1 2 3
2 3 1
3 2 1
1 2 3
1 2 3
2 1 3
...

output:

2

result:

ok 1 number(s): "2"

Test #69:

score: 0
Accepted
time: 2945ms
memory: 287720kb

input:

10000
3 2 1
3 1 2
2 1 3
1 2 3
1 3 2
3 2 1
1 2 3
3 1 2
1 2 3
2 1 3
2 1 3
3 2 1
1 3 2
2 3 1
3 1 2
3 1 2
3 2 1
3 2 1
2 3 1
1 2 3
1 2 3
2 3 1
2 1 3
1 2 3
2 3 1
3 2 1
2 1 3
2 1 3
2 3 1
1 3 2
1 2 3
2 1 3
3 2 1
1 3 2
2 1 3
3 1 2
2 1 3
2 3 1
1 2 3
2 1 3
3 1 2
1 3 2
3 2 1
2 3 1
2 1 3
2 1 3
2 1 3
2 1 3
1 3 2
...

output:

3

result:

ok 1 number(s): "3"

Test #70:

score: 0
Accepted
time: 2979ms
memory: 285932kb

input:

10000
1 2 3
1 3 2
1 3 2
2 1 3
3 2 1
3 2 1
3 2 1
1 3 2
3 1 2
1 2 3
3 2 1
2 3 1
3 2 1
2 3 1
3 1 2
1 3 2
3 2 1
1 2 3
2 3 1
3 1 2
2 1 3
1 2 3
3 2 1
3 2 1
1 2 3
2 1 3
3 1 2
2 3 1
3 2 1
1 3 2
3 2 1
1 2 3
1 3 2
1 2 3
1 2 3
2 1 3
3 1 2
2 3 1
1 3 2
3 2 1
3 1 2
3 1 2
1 2 3
2 1 3
1 2 3
3 2 1
3 2 1
2 1 3
3 1 2
...

output:

1

result:

ok 1 number(s): "1"

Test #71:

score: 0
Accepted
time: 2885ms
memory: 285904kb

input:

10000
2 1 3
3 2 1
1 2 3
2 3 1
2 1 3
1 2 3
1 3 2
2 3 1
2 1 3
1 2 3
3 1 2
1 2 3
1 3 2
1 3 2
2 3 1
3 2 1
1 3 2
3 1 2
1 2 3
3 2 1
2 1 3
3 2 1
1 2 3
2 3 1
1 2 3
3 2 1
1 3 2
3 2 1
2 1 3
3 2 1
1 2 3
2 1 3
2 1 3
1 3 2
1 3 2
1 2 3
3 1 2
1 2 3
1 2 3
2 1 3
1 3 2
1 3 2
1 3 2
3 1 2
1 2 3
2 1 3
1 3 2
1 3 2
2 1 3
...

output:

3

result:

ok 1 number(s): "3"

Test #72:

score: 0
Accepted
time: 3059ms
memory: 287632kb

input:

10000
3 1 2
2 1 3
1 3 2
2 3 1
2 3 1
1 2 3
1 3 2
3 2 1
1 3 2
3 2 1
3 2 1
3 2 1
3 1 2
3 2 1
3 2 1
2 1 3
3 2 1
3 2 1
3 1 2
2 3 1
1 2 3
1 3 2
3 1 2
1 3 2
1 3 2
3 1 2
3 1 2
3 1 2
2 3 1
1 3 2
2 3 1
2 1 3
2 1 3
2 1 3
3 2 1
3 1 2
1 2 3
3 2 1
3 2 1
1 2 3
3 2 1
1 3 2
1 2 3
3 2 1
1 3 2
2 3 1
3 2 1
3 1 2
2 3 1
...

output:

2

result:

ok 1 number(s): "2"

Test #73:

score: 0
Accepted
time: 3055ms
memory: 285952kb

input:

10000
1 3 2
3 1 2
3 1 2
3 2 1
3 1 2
1 3 2
1 2 3
2 3 1
3 2 1
3 1 2
3 2 1
1 3 2
1 3 2
3 2 1
2 1 3
3 1 2
3 2 1
1 2 3
3 2 1
2 3 1
3 1 2
3 2 1
2 3 1
2 3 1
2 3 1
1 3 2
1 2 3
3 2 1
2 1 3
2 3 1
2 3 1
1 3 2
2 3 1
3 2 1
3 2 1
3 2 1
2 3 1
2 3 1
1 2 3
3 2 1
2 3 1
1 3 2
3 2 1
3 1 2
1 2 3
1 2 3
1 3 2
3 2 1
1 2 3
...

output:

2

result:

ok 1 number(s): "2"

Test #74:

score: 0
Accepted
time: 2869ms
memory: 285952kb

input:

10000
3 1 2
1 2 3
3 1 2
3 1 2
1 3 2
2 3 1
1 2 3
3 1 2
3 2 1
1 3 2
2 1 3
2 1 3
3 2 1
1 3 2
2 3 1
2 1 3
3 2 1
3 2 1
3 2 1
2 3 1
1 2 3
3 2 1
2 1 3
2 3 1
2 3 1
1 3 2
3 2 1
3 1 2
2 1 3
1 3 2
3 2 1
3 2 1
1 2 3
1 2 3
3 2 1
3 1 2
2 1 3
2 3 1
2 3 1
1 3 2
3 2 1
3 1 2
2 3 1
2 3 1
3 2 1
1 2 3
3 2 1
3 1 2
1 3 2
...

output:

3

result:

ok 1 number(s): "3"

Test #75:

score: 0
Accepted
time: 2887ms
memory: 285976kb

input:

10000
2 3 1
3 2 1
3 1 2
1 3 2
3 2 1
2 3 1
3 1 2
3 1 2
1 2 3
3 2 1
2 1 3
1 3 2
1 3 2
3 2 1
2 3 1
1 3 2
1 3 2
2 1 3
3 2 1
1 3 2
3 2 1
2 3 1
2 1 3
1 3 2
1 2 3
2 3 1
2 3 1
2 3 1
1 2 3
1 2 3
3 1 2
1 3 2
2 3 1
2 1 3
2 3 1
2 1 3
3 1 2
1 2 3
1 3 2
2 3 1
1 3 2
1 3 2
3 2 1
1 3 2
2 3 1
1 2 3
2 1 3
2 1 3
3 2 1
...

output:

2

result:

ok 1 number(s): "2"

Test #76:

score: 0
Accepted
time: 2945ms
memory: 287692kb

input:

10000
1 3 2
1 2 3
2 1 3
2 1 3
1 2 3
1 3 2
2 3 1
3 2 1
2 3 1
3 2 1
1 2 3
2 1 3
2 1 3
3 1 2
1 2 3
3 1 2
3 2 1
2 1 3
2 1 3
2 3 1
2 3 1
1 3 2
3 1 2
3 1 2
1 2 3
3 2 1
2 1 3
3 2 1
3 2 1
1 3 2
3 2 1
2 3 1
1 2 3
2 1 3
2 3 1
3 1 2
1 2 3
2 1 3
2 3 1
3 1 2
3 2 1
3 2 1
1 3 2
2 1 3
1 2 3
1 2 3
2 3 1
2 1 3
1 3 2
...

output:

2

result:

ok 1 number(s): "2"

Test #77:

score: 0
Accepted
time: 2908ms
memory: 286204kb

input:

10000
2 1 3
3 2 1
3 1 2
1 2 3
1 2 3
2 3 1
1 2 3
3 1 2
2 1 3
2 3 1
3 2 1
3 2 1
1 2 3
2 3 1
1 2 3
2 1 3
2 3 1
1 3 2
2 1 3
2 1 3
2 1 3
1 3 2
1 3 2
2 1 3
1 2 3
3 2 1
2 1 3
2 3 1
3 1 2
3 1 2
2 1 3
1 3 2
2 3 1
3 1 2
1 3 2
3 2 1
1 3 2
2 1 3
2 1 3
2 1 3
3 2 1
2 3 1
2 1 3
3 2 1
2 1 3
3 1 2
2 3 1
2 3 1
2 3 1
...

output:

3

result:

ok 1 number(s): "3"

Test #78:

score: 0
Accepted
time: 2932ms
memory: 287760kb

input:

10000
3 2 1
1 2 3
2 3 1
3 2 1
1 3 2
3 2 1
3 2 1
2 3 1
3 1 2
1 2 3
1 2 3
1 3 2
1 2 3
1 3 2
2 3 1
2 3 1
1 2 3
3 1 2
3 2 1
3 1 2
2 1 3
1 2 3
1 2 3
2 1 3
1 3 2
1 3 2
3 2 1
3 2 1
1 2 3
1 2 3
3 2 1
3 2 1
3 1 2
2 1 3
1 3 2
3 1 2
3 1 2
2 3 1
1 2 3
2 1 3
3 1 2
3 1 2
1 2 3
2 3 1
2 1 3
1 2 3
1 3 2
2 3 1
3 1 2
...

output:

3

result:

ok 1 number(s): "3"

Test #79:

score: 0
Accepted
time: 2910ms
memory: 287576kb

input:

10000
3 1 2
2 1 3
3 2 1
2 1 3
3 1 2
1 2 3
2 3 1
2 1 3
3 1 2
3 2 1
1 3 2
3 2 1
2 3 1
1 2 3
2 3 1
1 3 2
2 3 1
1 3 2
2 3 1
1 3 2
2 3 1
3 2 1
1 3 2
1 2 3
3 1 2
2 3 1
1 2 3
3 2 1
3 1 2
3 2 1
1 2 3
2 1 3
3 2 1
2 1 3
2 3 1
1 3 2
1 3 2
3 2 1
2 1 3
1 3 2
2 3 1
3 1 2
2 1 3
3 1 2
3 2 1
1 2 3
2 1 3
1 3 2
2 1 3
...

output:

1

result:

ok 1 number(s): "1"

Test #80:

score: 0
Accepted
time: 2928ms
memory: 287496kb

input:

10000
3 1 2
3 1 2
3 1 2
3 2 1
1 3 2
1 2 3
2 1 3
2 1 3
2 3 1
2 1 3
1 3 2
3 2 1
2 1 3
1 2 3
1 3 2
2 1 3
3 2 1
3 1 2
3 1 2
3 2 1
1 3 2
1 3 2
3 1 2
3 2 1
1 3 2
1 3 2
2 1 3
1 2 3
2 1 3
2 1 3
3 1 2
2 3 1
1 2 3
1 2 3
1 3 2
1 2 3
3 1 2
3 2 1
2 3 1
2 1 3
2 1 3
2 1 3
3 2 1
1 2 3
2 1 3
1 3 2
3 2 1
3 1 2
1 3 2
...

output:

3

result:

ok 1 number(s): "3"

Test #81:

score: 0
Accepted
time: 2909ms
memory: 287932kb

input:

10000
3 1 2
2 1 3
2 1 3
3 1 2
1 3 2
1 3 2
3 1 2
2 1 3
3 1 2
3 1 2
3 1 2
1 2 3
3 2 1
2 3 1
3 2 1
3 2 1
2 3 1
2 1 3
2 1 3
1 3 2
1 3 2
1 3 2
1 3 2
2 3 1
2 1 3
2 3 1
2 1 3
3 2 1
3 1 2
2 1 3
1 2 3
2 3 1
2 3 1
3 1 2
2 3 1
2 3 1
2 1 3
2 3 1
3 1 2
3 1 2
3 1 2
3 1 2
1 2 3
3 1 2
2 1 3
3 2 1
1 3 2
2 1 3
2 3 1
...

output:

2

result:

ok 1 number(s): "2"

Test #82:

score: 0
Accepted
time: 2977ms
memory: 285668kb

input:

10000
1 2 3
3 2 1
3 2 1
3 2 1
1 2 3
2 3 1
2 3 1
2 3 1
2 3 1
3 1 2
2 1 3
1 3 2
3 2 1
3 2 1
1 3 2
2 1 3
3 2 1
1 2 3
3 1 2
3 2 1
2 3 1
3 1 2
1 3 2
3 1 2
2 3 1
3 1 2
2 1 3
1 2 3
2 1 3
2 1 3
3 1 2
3 1 2
2 3 1
2 3 1
2 1 3
2 3 1
2 1 3
1 3 2
1 2 3
1 2 3
3 1 2
2 1 3
2 1 3
3 2 1
1 2 3
2 3 1
2 1 3
1 2 3
3 2 1
...

output:

3

result:

ok 1 number(s): "3"

Test #83:

score: 0
Accepted
time: 2967ms
memory: 286072kb

input:

10000
1 3 2
2 3 1
1 3 2
2 1 3
1 3 2
3 1 2
3 1 2
2 3 1
3 1 2
2 3 1
2 3 1
3 1 2
3 2 1
3 1 2
1 2 3
3 2 1
1 3 2
3 2 1
3 2 1
1 3 2
1 2 3
1 2 3
1 3 2
1 2 3
3 1 2
3 2 1
3 1 2
2 3 1
1 3 2
3 1 2
2 3 1
3 1 2
3 1 2
3 2 1
3 1 2
3 2 1
3 1 2
3 2 1
1 2 3
3 1 2
2 1 3
2 3 1
2 3 1
1 3 2
1 3 2
3 1 2
3 1 2
3 1 2
3 1 2
...

output:

1

result:

ok 1 number(s): "1"

Test #84:

score: 0
Accepted
time: 2945ms
memory: 287732kb

input:

10000
3 2 1
3 1 2
3 1 2
1 2 3
1 2 3
2 3 1
1 2 3
3 2 1
1 3 2
1 3 2
2 3 1
3 2 1
2 3 1
1 3 2
2 1 3
1 2 3
2 3 1
3 2 1
3 2 1
1 2 3
3 2 1
2 1 3
2 3 1
3 1 2
1 2 3
2 1 3
3 2 1
1 2 3
3 2 1
3 1 2
2 1 3
3 1 2
3 1 2
3 1 2
2 1 3
3 1 2
3 1 2
3 1 2
1 2 3
3 1 2
2 3 1
1 2 3
1 3 2
2 3 1
1 3 2
2 3 1
3 2 1
1 2 3
3 2 1
...

output:

1

result:

ok 1 number(s): "1"

Test #85:

score: 0
Accepted
time: 2922ms
memory: 286060kb

input:

10000
3 1 2
1 3 2
2 3 1
2 3 1
3 1 2
2 1 3
2 1 3
2 3 1
2 1 3
2 1 3
3 2 1
3 2 1
3 1 2
3 2 1
3 1 2
2 1 3
1 3 2
3 2 1
2 3 1
1 3 2
3 2 1
1 2 3
3 2 1
1 3 2
1 3 2
3 2 1
1 3 2
1 2 3
2 1 3
2 3 1
3 1 2
1 2 3
3 1 2
1 3 2
1 2 3
3 2 1
3 1 2
2 1 3
2 1 3
2 1 3
1 2 3
1 2 3
3 1 2
2 1 3
2 3 1
1 3 2
1 2 3
2 1 3
1 3 2
...

output:

3

result:

ok 1 number(s): "3"

Test #86:

score: 0
Accepted
time: 2899ms
memory: 285628kb

input:

10000
1 2 3
2 3 1
2 3 1
3 2 1
3 1 2
1 3 2
3 1 2
3 2 1
1 2 3
2 1 3
1 2 3
2 1 3
3 1 2
3 2 1
3 1 2
1 2 3
2 1 3
1 3 2
1 2 3
1 2 3
1 3 2
3 1 2
1 3 2
1 2 3
3 2 1
1 3 2
3 2 1
2 1 3
2 3 1
2 1 3
2 1 3
1 3 2
2 1 3
1 2 3
3 2 1
1 3 2
1 3 2
3 2 1
3 2 1
3 2 1
3 1 2
3 2 1
1 3 2
1 2 3
2 1 3
2 1 3
2 3 1
2 3 1
1 2 3
...

output:

3

result:

ok 1 number(s): "3"

Test #87:

score: 0
Accepted
time: 2936ms
memory: 287608kb

input:

10000
1 3 2
1 2 3
2 3 1
1 2 3
2 1 3
2 3 1
3 1 2
3 2 1
3 2 1
1 2 3
3 1 2
1 3 2
3 2 1
2 3 1
3 2 1
2 1 3
3 2 1
2 1 3
3 2 1
3 1 2
2 3 1
3 1 2
3 2 1
2 1 3
2 1 3
1 2 3
1 2 3
1 3 2
3 2 1
3 1 2
2 1 3
2 3 1
2 3 1
1 3 2
1 3 2
3 2 1
1 3 2
3 1 2
3 1 2
2 3 1
2 3 1
3 1 2
3 1 2
2 1 3
2 1 3
2 3 1
1 2 3
2 3 1
2 3 1
...

output:

3

result:

ok 1 number(s): "3"

Test #88:

score: 0
Accepted
time: 2992ms
memory: 287788kb

input:

10000
1 2 3
1 3 2
3 1 2
3 2 1
1 2 3
1 3 2
2 3 1
3 1 2
3 2 1
3 1 2
3 2 1
1 2 3
1 3 2
1 2 3
2 3 1
2 3 1
3 2 1
2 3 1
3 2 1
1 3 2
3 1 2
3 2 1
2 1 3
1 3 2
3 1 2
2 1 3
2 1 3
3 2 1
3 1 2
1 2 3
3 1 2
1 3 2
3 2 1
3 1 2
3 1 2
1 3 2
3 1 2
3 1 2
1 3 2
2 1 3
3 1 2
1 2 3
1 2 3
2 3 1
1 3 2
2 3 1
3 2 1
2 3 1
1 3 2
...

output:

1

result:

ok 1 number(s): "1"

Test #89:

score: 0
Accepted
time: 2922ms
memory: 285752kb

input:

10000
3 2 1
3 1 2
1 2 3
2 1 3
2 3 1
2 3 1
3 1 2
2 1 3
2 1 3
2 1 3
3 1 2
2 1 3
1 2 3
3 2 1
2 1 3
3 1 2
3 1 2
2 1 3
2 1 3
1 2 3
1 3 2
1 2 3
3 2 1
3 2 1
2 1 3
2 1 3
1 2 3
2 3 1
3 2 1
1 3 2
2 3 1
1 3 2
3 1 2
2 1 3
3 1 2
3 1 2
1 2 3
2 3 1
3 2 1
3 2 1
2 1 3
3 2 1
3 1 2
3 2 1
1 2 3
2 1 3
3 1 2
2 1 3
3 1 2
...

output:

2

result:

ok 1 number(s): "2"

Test #90:

score: 0
Accepted
time: 2899ms
memory: 286120kb

input:

10000
1 2 3
1 2 3
2 3 1
1 3 2
1 3 2
3 1 2
1 3 2
1 3 2
2 1 3
2 3 1
2 1 3
1 2 3
2 1 3
2 1 3
2 3 1
1 3 2
1 3 2
1 2 3
2 1 3
1 3 2
1 2 3
1 2 3
1 3 2
1 2 3
2 3 1
2 3 1
3 1 2
1 3 2
1 2 3
3 2 1
3 1 2
3 1 2
3 1 2
2 3 1
1 3 2
1 2 3
2 1 3
3 1 2
1 3 2
3 1 2
2 3 1
3 2 1
3 1 2
3 1 2
1 2 3
1 2 3
2 1 3
2 1 3
3 2 1
...

output:

2

result:

ok 1 number(s): "2"

Test #91:

score: 0
Accepted
time: 2977ms
memory: 285684kb

input:

10000
3 2 1
3 1 2
1 2 3
2 3 1
2 3 1
2 1 3
2 3 1
2 3 1
1 3 2
1 3 2
1 3 2
2 3 1
2 1 3
3 2 1
2 1 3
1 2 3
3 1 2
2 1 3
1 3 2
1 2 3
1 2 3
3 1 2
1 2 3
2 3 1
1 2 3
3 1 2
1 3 2
1 2 3
1 2 3
1 3 2
3 2 1
2 1 3
1 2 3
1 2 3
2 1 3
3 2 1
1 3 2
3 1 2
1 3 2
2 3 1
3 2 1
3 2 1
2 1 3
3 1 2
1 3 2
3 2 1
3 2 1
3 2 1
1 3 2
...

output:

1

result:

ok 1 number(s): "1"

Test #92:

score: 0
Accepted
time: 2882ms
memory: 285872kb

input:

10000
3 2 1
1 3 2
3 2 1
1 2 3
3 2 1
1 2 3
3 2 1
3 1 2
3 2 1
1 2 3
1 2 3
1 2 3
2 1 3
3 1 2
3 1 2
1 3 2
2 3 1
3 2 1
2 3 1
3 2 1
1 2 3
3 2 1
1 2 3
2 1 3
3 2 1
2 1 3
1 2 3
2 1 3
2 3 1
1 2 3
1 2 3
3 2 1
1 2 3
1 2 3
2 3 1
2 1 3
2 1 3
2 3 1
2 1 3
3 1 2
3 2 1
3 2 1
2 3 1
1 2 3
2 3 1
3 1 2
2 3 1
3 1 2
2 3 1
...

output:

2

result:

ok 1 number(s): "2"

Test #93:

score: 0
Accepted
time: 2894ms
memory: 287816kb

input:

10000
2 3 1
3 2 1
3 2 1
3 2 1
2 3 1
2 1 3
3 2 1
1 3 2
3 2 1
1 2 3
1 2 3
2 3 1
2 3 1
1 2 3
2 1 3
1 3 2
1 2 3
3 1 2
1 3 2
2 1 3
1 2 3
1 3 2
1 3 2
2 3 1
1 3 2
2 3 1
3 2 1
3 2 1
1 2 3
1 2 3
3 2 1
1 3 2
2 1 3
1 3 2
2 3 1
1 3 2
3 1 2
1 3 2
2 3 1
2 3 1
3 1 2
3 2 1
2 3 1
1 3 2
3 2 1
3 2 1
1 2 3
1 2 3
1 3 2
...

output:

3

result:

ok 1 number(s): "3"

Test #94:

score: 0
Accepted
time: 2982ms
memory: 287784kb

input:

10000
1 3 2
1 2 3
3 2 1
2 1 3
2 1 3
1 3 2
2 3 1
3 1 2
3 2 1
1 3 2
3 1 2
2 1 3
1 3 2
1 2 3
2 1 3
3 1 2
3 2 1
1 3 2
1 2 3
3 1 2
2 3 1
1 2 3
2 1 3
2 1 3
1 2 3
1 2 3
2 1 3
1 2 3
3 1 2
1 2 3
3 1 2
3 1 2
1 2 3
3 2 1
1 2 3
1 3 2
3 2 1
3 1 2
1 3 2
2 1 3
3 2 1
2 1 3
2 1 3
2 3 1
3 1 2
1 2 3
2 1 3
1 3 2
3 1 2
...

output:

1

result:

ok 1 number(s): "1"

Test #95:

score: 0
Accepted
time: 2932ms
memory: 285892kb

input:

10000
1 3 2
3 2 1
2 3 1
2 1 3
1 2 3
2 3 1
3 2 1
3 2 1
2 3 1
2 3 1
2 3 1
2 3 1
3 2 1
2 1 3
3 1 2
2 1 3
2 1 3
3 2 1
2 1 3
3 1 2
2 1 3
1 3 2
2 3 1
3 2 1
2 1 3
2 3 1
3 1 2
3 1 2
1 3 2
3 2 1
3 1 2
1 3 2
2 3 1
1 2 3
3 1 2
2 3 1
2 3 1
3 2 1
3 2 1
1 3 2
3 2 1
1 3 2
2 1 3
3 1 2
3 1 2
2 1 3
3 1 2
1 3 2
1 2 3
...

output:

1

result:

ok 1 number(s): "1"

Test #96:

score: 0
Accepted
time: 3020ms
memory: 285504kb

input:

10000
2 3 1
1 2 3
1 2 3
1 2 3
2 1 3
2 1 3
1 2 3
3 2 1
3 1 2
1 2 3
1 2 3
2 3 1
3 1 2
2 3 1
3 1 2
1 3 2
1 2 3
3 2 1
2 3 1
2 3 1
3 1 2
3 2 1
1 3 2
3 1 2
3 2 1
1 2 3
3 1 2
1 2 3
1 2 3
1 3 2
3 2 1
1 2 3
3 1 2
3 1 2
3 1 2
2 3 1
3 1 2
2 3 1
2 1 3
1 2 3
1 2 3
1 2 3
3 1 2
2 1 3
1 3 2
1 2 3
2 3 1
3 1 2
1 3 2
...

output:

2

result:

ok 1 number(s): "2"

Test #97:

score: 0
Accepted
time: 2996ms
memory: 285636kb

input:

10000
1 3 2
2 3 1
3 1 2
2 3 1
2 3 1
1 2 3
2 3 1
1 3 2
1 2 3
2 3 1
3 1 2
1 3 2
2 3 1
3 1 2
3 1 2
1 2 3
3 1 2
3 2 1
3 1 2
3 1 2
3 1 2
2 3 1
2 1 3
2 1 3
2 3 1
2 3 1
2 3 1
2 1 3
1 3 2
2 3 1
3 1 2
1 3 2
1 2 3
1 3 2
3 2 1
3 1 2
3 1 2
2 1 3
2 1 3
2 1 3
1 2 3
3 1 2
1 2 3
1 2 3
3 1 2
2 1 3
3 1 2
1 2 3
2 3 1
...

output:

3

result:

ok 1 number(s): "3"

Test #98:

score: 0
Accepted
time: 2936ms
memory: 287640kb

input:

10000
1 2 3
2 1 3
2 1 3
3 1 2
2 1 3
1 3 2
1 3 2
2 3 1
1 3 2
1 3 2
2 3 1
3 2 1
2 1 3
2 3 1
1 2 3
1 3 2
3 2 1
2 3 1
3 1 2
3 2 1
1 3 2
3 2 1
3 1 2
1 3 2
2 1 3
3 1 2
2 3 1
3 2 1
1 2 3
3 1 2
3 2 1
2 3 1
3 1 2
1 3 2
3 1 2
3 1 2
2 1 3
1 2 3
3 1 2
2 1 3
1 2 3
2 3 1
1 3 2
1 2 3
1 2 3
3 2 1
3 1 2
2 3 1
3 1 2
...

output:

3

result:

ok 1 number(s): "3"

Test #99:

score: 0
Accepted
time: 1ms
memory: 5748kb

input:

1
1 2 3

output:

1

result:

ok 1 number(s): "1"

Test #100:

score: 0
Accepted
time: 1ms
memory: 5632kb

input:

1
2 3 1

output:

2

result:

ok 1 number(s): "2"

Test #101:

score: 0
Accepted
time: 2952ms
memory: 285572kb

input:

10000
2 3 1
3 1 2
3 2 1
3 2 1
1 2 3
1 2 3
2 3 1
3 2 1
1 3 2
1 3 2
2 3 1
1 2 3
3 2 1
3 2 1
2 3 1
1 3 2
2 1 3
1 3 2
2 1 3
1 3 2
1 3 2
3 1 2
2 3 1
2 3 1
3 2 1
3 1 2
3 2 1
1 3 2
1 3 2
3 2 1
3 2 1
1 2 3
3 2 1
1 2 3
2 3 1
2 3 1
2 3 1
2 3 1
2 3 1
2 1 3
2 1 3
2 1 3
2 3 1
2 3 1
2 3 1
2 3 1
3 2 1
2 1 3
1 2 3
...

output:

1

result:

ok 1 number(s): "1"

Test #102:

score: 0
Accepted
time: 19ms
memory: 27036kb

input:

1000
1 3 2
2 3 1
2 1 3
3 1 2
1 3 2
1 3 2
1 3 2
3 2 1
3 2 1
2 3 1
1 3 2
1 2 3
2 1 3
1 2 3
1 3 2
1 2 3
3 2 1
2 3 1
3 2 1
2 1 3
1 3 2
2 3 1
2 3 1
3 2 1
2 1 3
3 1 2
1 2 3
2 3 1
1 2 3
2 1 3
2 3 1
1 2 3
3 2 1
3 2 1
2 1 3
3 2 1
3 2 1
2 3 1
3 2 1
1 2 3
1 2 3
2 3 1
1 2 3
3 2 1
1 2 3
1 3 2
1 3 2
2 3 1
2 1 3
2...

output:

2

result:

ok 1 number(s): "2"

Test #103:

score: 0
Accepted
time: 4ms
memory: 17156kb

input:

500
1 3 2
2 3 1
2 1 3
2 1 3
3 1 2
2 1 3
3 1 2
2 3 1
3 2 1
1 2 3
1 3 2
1 3 2
1 3 2
1 3 2
1 3 2
2 3 1
3 2 1
3 1 2
2 1 3
2 3 1
2 3 1
1 3 2
3 1 2
3 1 2
3 1 2
1 3 2
1 2 3
2 1 3
1 3 2
2 1 3
3 2 1
1 3 2
1 3 2
3 1 2
1 2 3
2 3 1
3 2 1
1 2 3
1 2 3
2 1 3
2 3 1
1 3 2
2 1 3
2 1 3
3 2 1
2 3 1
1 3 2
2 1 3
2 1 3
3 ...

output:

1

result:

ok 1 number(s): "1"

Test #104:

score: 0
Accepted
time: 0ms
memory: 12768kb

input:

300
3 1 2
2 3 1
1 2 3
3 2 1
1 2 3
2 1 3
3 1 2
1 2 3
3 2 1
1 2 3
1 2 3
3 2 1
2 3 1
1 2 3
2 3 1
2 1 3
3 1 2
3 1 2
2 1 3
2 1 3
2 3 1
2 1 3
3 1 2
1 3 2
3 2 1
1 3 2
3 1 2
1 3 2
2 1 3
1 3 2
2 1 3
1 2 3
2 1 3
3 2 1
2 1 3
1 2 3
2 1 3
1 3 2
3 1 2
1 3 2
2 1 3
1 3 2
3 2 1
3 1 2
3 1 2
2 1 3
1 3 2
2 3 1
3 2 1
1 ...

output:

1

result:

ok 1 number(s): "1"

Test #105:

score: 0
Accepted
time: 1ms
memory: 8196kb

input:

100
3 2 1
3 1 2
1 2 3
2 1 3
3 2 1
3 2 1
1 2 3
1 3 2
3 1 2
3 2 1
3 1 2
1 3 2
3 2 1
2 1 3
2 1 3
3 2 1
2 1 3
3 2 1
1 3 2
3 2 1
1 2 3
1 3 2
3 2 1
3 1 2
1 3 2
3 1 2
3 1 2
3 1 2
1 3 2
3 1 2
2 1 3
1 3 2
1 2 3
3 1 2
3 2 1
1 2 3
1 3 2
3 2 1
1 3 2
1 3 2
2 1 3
1 3 2
3 2 1
3 2 1
2 1 3
1 3 2
3 1 2
1 2 3
1 2 3
2 ...

output:

2

result:

ok 1 number(s): "2"

Extra Test:

score: 0
Extra Test Passed