QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#233090#7636. Fair Electionsucup-team1209AC ✓695ms4456kbC++201.5kb2023-10-31 13:07:132023-10-31 13:07:13

Judging History

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

  • [2023-10-31 13:07:13]
  • 评测
  • 测评结果:AC
  • 用时:695ms
  • 内存:4456kb
  • [2023-10-31 13:07:13]
  • 提交

answer

#include<bits/stdc++.h>
using std::cin, std::cout;
int n, m;
using pr = std::pair<int, int>;
const int N = 10005;
std::vector<pr> dp[N];
int rank[N][3];
int get(int x, int y, int z) {
	if(x >= y && x >= z) return 0;
	if(y > x && y >= z) return 1;
	return 2;
}
int per[3];
int min(int x, int y) { return per[x] < per[y] ? x : y; }
int main() {
	std::ios::sync_with_stdio(false), cin.tie(0);
	cin >> n;
	for(int i = 1;i <= n;++i) {
		for(int j = 0;j < 3;++j) {
			cin >> rank[i][j];
			-- rank[i][j];
		}
	}
	for(int i = 0;i <= n;++i) {
		dp[i].emplace_back(get(i, 0, n - i), 0);
		for(int j = 1;j + i <= n;++j) {
			int w = get(i, j, n - i - j);
			if(w != dp[i].back().first) {
				dp[i].emplace_back(w, j);
			}
		}
		dp[i].emplace_back(0, n + 1);
	}
	for(int i = n;i >= 1;--i) {
		for(int j = 0;j < 3;++j) per[rank[i][j]] = j;
		for(int j = 0;j < i;++j) {
			static std::vector<pr> res; res.clear();
			auto & A = dp[j];
			auto & B = dp[j + 1];
			for(int i = 1;i + 1 < (int) A.size();++i) {
				if(per[A[i].first] < per[A[i - 1].first]) {
					-- A[i].second;
				}
			}
			int id = 0;
			int x = 0, y = 0;
			for(;id < i;) {
				for(;A[x + 1].second <= id;) x += 1;
				for(;B[y + 1].second <= id;) y += 1;
				int w = min(A[x].first, B[y].first);
				if(!id || w != res.back().first) {
					res.emplace_back(w, id);
				}
				id = std::min(A[x + 1].second, B[y + 1].second);
			}
			res.emplace_back(0, i);
			dp[j] = res;
		}
	}
	cout << dp[0][0].first + 1 << '\n';
}

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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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: 0ms
memory: 3912kb

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: 0ms
memory: 3848kb

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: 0ms
memory: 3944kb

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: 0ms
memory: 3884kb

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: 0ms
memory: 3944kb

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: 0ms
memory: 3884kb

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: 0ms
memory: 3804kb

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: 0ms
memory: 3852kb

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: 0ms
memory: 3864kb

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: 0ms
memory: 3944kb

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: 670ms
memory: 4340kb

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: 671ms
memory: 4392kb

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: 675ms
memory: 4328kb

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: 678ms
memory: 4352kb

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: 677ms
memory: 4320kb

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: 675ms
memory: 4392kb

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: 672ms
memory: 4296kb

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: 679ms
memory: 4388kb

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: 680ms
memory: 4368kb

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: 676ms
memory: 4368kb

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: 673ms
memory: 4372kb

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: 673ms
memory: 4396kb

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: 673ms
memory: 4424kb

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: 672ms
memory: 4352kb

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: 673ms
memory: 4324kb

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: 672ms
memory: 4380kb

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: 668ms
memory: 4324kb

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: 671ms
memory: 4356kb

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: 673ms
memory: 4368kb

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: 664ms
memory: 4356kb

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: 7ms
memory: 4000kb

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: 8ms
memory: 3968kb

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: 7ms
memory: 3932kb

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: 3ms
memory: 3920kb

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: 7ms
memory: 3912kb

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: 7ms
memory: 3916kb

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: 8ms
memory: 3912kb

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: 7ms
memory: 3944kb

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: 8ms
memory: 3908kb

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: 7ms
memory: 3952kb

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: 7ms
memory: 4004kb

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: 7ms
memory: 3940kb

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: 3ms
memory: 3844kb

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: 7ms
memory: 3876kb

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: 7ms
memory: 3916kb

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: 7ms
memory: 4000kb

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: 8ms
memory: 4004kb

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: 7ms
memory: 3916kb

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: 7ms
memory: 3940kb

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: 7ms
memory: 3868kb

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: 672ms
memory: 4360kb

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: 666ms
memory: 4420kb

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: 673ms
memory: 4320kb

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: 666ms
memory: 4296kb

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: 673ms
memory: 4428kb

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: 674ms
memory: 4456kb

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: 675ms
memory: 4368kb

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: 670ms
memory: 4360kb

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: 673ms
memory: 4448kb

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: 673ms
memory: 4296kb

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: 675ms
memory: 4452kb

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: 673ms
memory: 4360kb

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: 668ms
memory: 4372kb

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: 670ms
memory: 4452kb

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: 670ms
memory: 4364kb

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: 667ms
memory: 4448kb

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: 672ms
memory: 4308kb

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: 672ms
memory: 4452kb

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: 674ms
memory: 4368kb

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: 674ms
memory: 4296kb

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: 672ms
memory: 4372kb

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: 672ms
memory: 4448kb

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: 668ms
memory: 4368kb

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: 695ms
memory: 4372kb

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: 678ms
memory: 4356kb

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: 672ms
memory: 4372kb

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: 671ms
memory: 4452kb

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: 670ms
memory: 4392kb

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: 671ms
memory: 4324kb

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: 672ms
memory: 4296kb

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: 672ms
memory: 4448kb

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: 672ms
memory: 4376kb

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: 672ms
memory: 4320kb

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: 669ms
memory: 4364kb

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: 689ms
memory: 4364kb

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: 673ms
memory: 4368kb

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: 670ms
memory: 4368kb

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: 673ms
memory: 4296kb

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: 674ms
memory: 4292kb

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: 668ms
memory: 4292kb

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: 670ms
memory: 4320kb

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: 673ms
memory: 4364kb

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: 674ms
memory: 4360kb

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: 668ms
memory: 4452kb

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: 669ms
memory: 4296kb

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: 672ms
memory: 4456kb

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: 672ms
memory: 4364kb

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: 0ms
memory: 3816kb

input:

1
1 2 3

output:

1

result:

ok 1 number(s): "1"

Test #100:

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

input:

1
2 3 1

output:

2

result:

ok 1 number(s): "2"

Test #101:

score: 0
Accepted
time: 679ms
memory: 4424kb

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: 7ms
memory: 3912kb

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: 2ms
memory: 3836kb

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: 1ms
memory: 3832kb

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: 3784kb

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