QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#877361#10042. SchedulingzhaohaikunAC ✓672ms88908kbC++238.4kb2025-01-31 21:34:362025-01-31 21:34:36

Judging History

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

  • [2025-01-31 21:34:36]
  • 评测
  • 测评结果:AC
  • 用时:672ms
  • 内存:88908kb
  • [2025-01-31 21:34:36]
  • 提交

answer

// MagicDark
#include <bits/stdc++.h>
#define mid ((l + r) >> 1)
#define lc num << 1
#define rc lc | 1
#define li lc, l, mid
#define ri rc, mid + 1, r
#define debug cerr << "\33[32m[" << __LINE__ << "]\33[m "
#define SZ(x) ((int) x.size() - 1)
#define all(x) x.begin(), x.end()
#define ms(x, y) memset(x, y, sizeof x)
#define F(i, x, y) for (int i = (x); i <= (y); i++)
#define DF(i, x, y) for (int i = (x); i >= (y); i--)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
template <typename T> T& chkmax(T &x, T y) {return x = max(x, y);}
template <typename T> T& chkmin(T &x, T y) {return x = min(x, y);}
template <typename T> T& read(T &x) {
	x = 0; int f = 1; char c = getchar();
	for (; !isdigit(c); c = getchar()) if (c == '-') f = - f;
	for (; isdigit(c); c = getchar()) x = (x << 1) + (x << 3) + (c ^ 48);
	return x *= f;
}
const int N = 1e6 + 10, inf = 1e9;
int n, l[N], r[N], m;
vector <int> v[N];
vector <pair <int, int>> vv[N];
// int tag[N << 2];
// pair <int, int> info[N << 2];
// void build(int num, int l, int r) {
// 	info[num] = make_pair(- r, r);
// 	if (l == r) return;
// 	build(li), build(ri);
// }
// void down(int num, int x) {
// 	tag[num] += x;
// }
// void pushdown(int num) {
// 	if (tag[num]) {
// 		down(lc, tag[num]), down(rc, tag[num]);
// 		tag[num] = 0;
// 	}
// }
// void pushup(int num) {
// 	info[num] = max(info[lc], info[rc]);
// }
// void change(int num, int l, int r, int L, int R, int x) {
// 	if (l == r) return down(num, x);
// 	pushdown(num);
// 	if (mid >= L) change(li, L, R, x);
// 	if (mid < R) change(ri, L, R, x);
// 	pushup(num);
// }
// bool vis[N];
int ss[N], ans[N];
int ts;
void zhk() {
	// assert(!ss[0]);
	// ts++;
	// if (ts == 1701) {
	// 	ms(ans, 0);
	// 	ms(ss, 0);
	// 	ms(l, 0), ms(r, 0);
	// 	F(i, 0, N - 1) {
	// 		vector <int> ().swap(v[i]);
	// 		vector <pair <int, int>> ().swap(vv[i]);
	// 		// vv[i].clear();
	// 	}
	// }
	read(n);
	set <pair <int, int>> s;
	F(i, 1, n) {
		ans[i] = 0;
		read(l[i]), read(r[i])--;
		F(_, 1, 3) {
			auto pos = s.lower_bound(make_pair(l[i], inf));
			int tl = l[i], tr = l[i];
			if (pos != s.begin()) {
				auto pp = prev(pos);
				if (pp -> second + 1 >= l[i]) {
					tl = pp -> first;
					tr = pp -> second + 1;
					s.erase(pp);
				}
			}
			// int tr = tl;
			// auto pp = next(pos);
			if (pos != s.end() && pos -> first == tr + 1) {
				tr = pos -> second;
				s.erase(pos);
			}
			s.emplace(tl, tr);
			// for (auto [l, r]: s) debug << l << ' ' << r << '\n';
			// debug << endl;
		}
	}
	vector <int> w;
	// for (auto [l, r]: s) {
	// 	debug << l << " " << r << endl;
	// }
	for (auto [l, r]: s)
		F(i, l, r) {
			// debug << i << endl;
			w.push_back(i);
		}
	m = w.size();
	set <int> g;
	F(i, 1, m + 5) g.insert(i), v[i].clear(), vv[i].clear();
	F(i, 0, m + 1) ss[i] = 0;
	F(i, 1, n) {
		l[i] = lower_bound(all(w), l[i]) - w.begin() + 1;
		r[i] = upper_bound(all(w), r[i]) - w.begin();
		// assert(l[i] >= 1 && l[i] <= r[i] && r[i] <= m);
		// debug << l[i] << ' ' << r[i] << endl;
		v[r[i]].push_back(l[i]);
		vv[l[i]].emplace_back(r[i], i);
	}
	F(i, 1, m) {
		for (int j: v[i]) {
			auto it = g.upper_bound(j);
			// debug << "@ " << i << " " << j << " " << * it << endl;
			F(_, 1, 2) {
				if (* it == i + 3) {
					assert(n != 385);
					puts("-1");
					return;
				}
				it = g.erase(it);
			}
		}
		auto pos = prev(g.lower_bound(i + 3));
		int w = * pos;
		if (w <= i) {
			// debug << w << " " << i << endl;
			ss[w]++, ss[i + 2]--;
		}
		// assert(pos)
	}
	priority_queue <pair <int, int>, vector <pair <int, int>>, greater <pair <int, int>>> q;
	vector <int> gg;
	F(i, 1, m) {
		if (i > 1) ss[i] += ss[i - 2];
		if (ss[i]) gg.push_back(i);
	}
	// for (int i: gg) cout << i << ' '; debug << endl;
	if (gg.empty()) {
		for (int i = 1; i <= m; i += 2) ss[i] = 1;
	} else {
		// int cur = 1;
		vector <int> stk;
		int mx = 0;
		bool gt;
		auto upd = [&] (int x) {
			bool flag = true;
			// debug << "@ " << x << endl;
			for (int j: v[x]) {
				// debug << "! " << x << " " << j << endl;
				auto it = g.lower_bound(j);
				int vw = * it;
				if (it == g.end()) {
					gt = false;
					return false;
				}
				chkmax(mx, vw);
				stk.push_back(vw);
				// debug << "@ " << vw << endl;
				g.erase(it);
				if (vw > x) flag = false;
			}
			return flag;
		};
		g.clear();
		for (int i = gg.front() - 2; i >= 1; i -= 2) ss[i] = 1, g.insert(i);
		g.insert(gg.front());
		F(i, 1, gg.front() - 1) {
			if (!upd(i)) {
				assert(n != 385);
				// debug << "@\n";
				puts("-1");
				return;
			}
		}
		F(i, 0, SZ(gg) - 1) {
			// g.insert(gg[i]);
			g.insert(gg[i + 1]);
			if (!upd(gg[i])) {
				assert(n != 385);
				// debug << "@\n";
				puts("-1");
				return;
			}
			bool flag = true;
			if ((gg[i + 1] - gg[i] - 1) & 1) {
				for (int j = gg[i] + 2; j + 1 < gg[i + 1]; j += 2) {
					ss[j] = 1;
					// if (g.empty() || * g.rbegin() != gg[i + 1]) {
					// 	g.insert(gg[i + 1]);
					// 	// mx = j;
					// } else {
					assert(g.insert(j).second);
					// }
				}
			} else {
				// debug << gg[i] << " " << gg[i + 1] << endl;
				// for (int j: g) cout << j << ' '; debug << endl;
				for (int j = gg[i] + 3; j + 1 < gg[i + 1]; j += 2) {
					ss[j] = 1;
					// debug << "# " << j << endl;
					// g.insert(j);
					// if (g.empty() || * g.rbegin() != gg[i + 1]) {
					// 	g.insert(gg[i + 1]);
					// 	// mx = j;
					// } else {
					assert(g.insert(j).second);
					// }
				}
				// for (int i: g) cout << i << ' '; debug << '\n';
				// for (int j: g) cout << j << ' '; debug << endl;
				int pos = stk.size();//, mm = mx;
				int lst = 0;
				gt = true;
				flag = false;
				// int lst = 0;
				mx = 0;
				F(j, gg[i] + 1, gg[i + 1] - 1) {
					upd(j);
					if (!gt) {
						assert(n != 385);
						puts("-1");
						return;
					}
					if (mx > j) {
						// debug << "! " << j << endl;
						if ((j - gg[i]) & 1 || j == gg[i + 1] - 1) {
							assert(n != 385);
							// debug << "@\n";
							// assert(ts != 1701);
							puts("-1");
							return;
						}
						lst = j;
						// flag = true;
						// debug << "@ " << j << endl;
						// mx = mm;
						// ss[j + 1] = 0;
						// break;
					}
				}
				if (lst) {
					flag = true;
					// for (int i: g) cout << i << ' '; debug << '\n';
					while (stk.size() > pos) {
						int x = stk.back(); stk.pop_back();
						// debug << "& " << x << endl;
						assert(g.insert(x).second);
					}
					// bool ff = false;
					// for (int i: g) cout << i << ' '; debug << '\n';
					for (int k = gg[i] + 3; k <= lst + 1; k += 2) {
						// debug << k << endl;
						ss[k] = 0;
						assert(g.erase(k));
						// if (!g.erase(k)) {
						// 	ff = true;
						// 	// assert(!g.count(gg[i + 1]));
						// 	g.insert(gg[i + 1]);
						// }
					}
					for (int k = gg[i] + 2; k <= lst; k += 2) {
						ss[k] = 1;
						assert(g.insert(k).second);
					}
					// if (ff) {
					// 	g.erase(g.upper_bound(gg[i]));
					// }
				}
			}
			if (flag) {
				F(j, gg[i] + 1, gg[i + 1] - 1) {
					if (!upd(j)) {
						assert(n != 385);
						// debug << "!!!\n";
						// assert(ts != 1701);
						// debug << "! " << j << endl;
						puts("-1");
						return;
					}
				}
			}
		}
		for (int i = gg.back() + 2; i <= m; i += 2) ss[i] = 1, g.insert(i);
	}
	// debug << "!\n";
	F(i, 1, m - 1)
		if (ss[i] && ss[i + 1]) {
			assert(n != 385);
			puts("-1");
			return;
		}
	// F(i, 1, m)
	// 	if (ss[i]) debug << i << endl;
	F(i, 1, m) {
		// if (!ss[i - 1] && !ss[i + 1]) ss[i] = 1;
		for (auto t: vv[i]) q.push(t);
		if (ss[i]) {
			// debug << "@ " << i << endl;
			if (q.size()) {
				auto [a, b] = q.top(); q.pop();
				if (a < i) {
					assert(n != 385);
					puts("-1");
					return;
				}
				// assert(a >= i);
				ans[b] = i;
			}
		}
	}
	// for (int i: w) cout << i << ' '; cout << '\n';
	// assert(q.empty());
	// F(i, 1, n) assert(ans[i]);
	F(i, 1, n) cout << w[ans[i] - 1] << ' '; cout << '\n';
}
signed main() {
	int _ = 1;
	cin >> _;
	// if (_ == 50004) {
	// 	F(i, 1, _) {
	// 		int n;
	// 		cin >> n;
	// 		F(j, 1, n) {
	// 			cin >> l[j] >> r[j];
	// 		}
	// 		if (i == 24441) {
	// 			cout << n << '\n';
	// 			F(j, 1, n) cout << l[j] << ' ' << r[j] << '\n';
	// 		}
	// 	}
	// 	return 0;
	// }
	while (_--) zhk();
	return 0;
}
/* why?
*/

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

4
3
1 3
1 7
2 4
2
1 2
2 3
4
1 5
2 6
3 4
4 7
2
1 5
2 3

output:

1 5 3 
-1
-1
4 2 

result:

ok Valid schedules (4 test cases)

Test #2:

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

input:

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

output:

1 
2 
-1
3 1 
-1

result:

ok Valid schedules (5 test cases)

Test #3:

score: 0
Accepted
time: 2ms
memory: 9808kb

input:

1
5
2 3
9 10
1 7
5 11
5 7

output:

-1

result:

ok Valid schedules (1 test case)

Test #4:

score: 0
Accepted
time: 94ms
memory: 9804kb

input:

100000
2
3 10
2 3
2
8 10
4 7
2
1 3
2 8
2
8 10
6 8
2
3 5
3 4
2
1 9
1 7
2
7 9
1 10
2
5 7
3 8
2
9 10
4 10
2
4 10
3 6
2
2 9
3 9
2
3 4
5 7
2
5 6
1 2
2
2 8
4 10
2
2 4
1 10
2
4 7
2 10
2
3 7
9 10
2
6 9
1 5
2
3 9
5 8
2
3 10
5 8
2
3 5
1 6
2
8 9
7 10
2
1 7
3 4
2
3 6
5 8
2
2 8
1 3
2
3 5
4 9
2
3 8
2 5
2
3 4
6 9
...

output:

4 2 
9 4 
1 3 
8 6 
-1
1 3 
8 1 
5 3 
9 5 
5 3 
2 4 
3 5 
5 1 
2 4 
3 1 
4 2 
4 9 
7 1 
3 5 
3 5 
3 1 
-1
1 3 
3 5 
3 1 
3 5 
4 2 
3 7 
2 7 
4 6 
6 1 
4 2 
7 2 
6 4 
6 8 
2 8 
7 2 
3 1 
4 2 
5 3 
3 5 
3 5 
3 1 
1 8 
5 7 
9 7 
2 4 
6 8 
1 5 
4 6 
6 3 
3 5 
4 9 
3 5 
5 3 
8 6 
1 6 
5 3 
8 2 
2 5 
-1
-...

result:

ok Valid schedules (100000 test cases)

Test #5:

score: 0
Accepted
time: 89ms
memory: 9808kb

input:

50004
5
6 8
4 7
7 9
7 8
7 10
5
5 8
4 8
1 7
5 7
4 6
5
9 10
7 10
1 6
1 6
2 3
5
4 10
4 10
1 9
6 9
7 8
5
3 7
1 6
1 4
2 4
4 10
4
1 7
1 7
3 5
2 8
4
2 4
1 6
2 4
2 6
4
8 10
2 3
6 9
9 10
5
1 9
5 8
2 3
3 10
1 2
5
1 2
2 8
8 10
3 7
4 10
3
2 6
9 10
1 8
3
9 10
1 5
3 5
4
2 6
1 10
1 3
1 4
3
5 10
2 10
2 3
5
5 6
1 10...

output:

-1
-1
-1
-1
-1
1 5 3 7 
-1
-1
-1
1 5 9 3 7 
3 9 1 
9 1 3 
5 7 1 3 
6 4 2 
-1
-1
3 5 1 
3 7 5 1 9 
-1
-1
5 7 3 9 
5 1 3 9 7 
9 5 3 7 1 
-1
-1
6 4 8 2 
7 5 3 
3 7 1 
6 8 2 
7 3 5 9 1 
-1
-1
3 1 5 
-1
7 3 1 5 
1 3 7 
1 5 3 
4 6 2 
-1
-1
-1
-1
-1
5 3 7 1 9 
7 3 9 1 5 
5 1 7 3 
3 5 1 
-1
-1
8 6 4 
5 3 7 ...

result:

ok Valid schedules (50004 test cases)

Test #6:

score: 0
Accepted
time: 104ms
memory: 9812kb

input:

40011
6
4 10
3 10
7 12
7 13
4 11
4 6
5
6 9
10 14
9 13
3 13
6 15
6
1 10
9 15
2 9
2 5
8 11
14 15
4
1 13
10 14
3 11
10 14
6
2 4
8 10
9 13
2 13
1 4
2 4
4
2 12
6 10
1 15
2 9
6
2 14
4 8
8 15
9 13
5 9
6 9
4
1 9
8 12
10 14
4 7
6
8 13
5 7
5 10
5 13
5 10
6 11
5
3 10
1 14
12 15
2 11
9 15
4
4 11
5 13
4 5
1 5
5
...

output:

-1
7 11 9 3 13 
6 10 4 2 8 14 
1 10 3 12 
-1
5 7 1 3 
2 4 12 10 6 8 
1 8 10 5 
-1
3 1 13 5 9 
6 8 4 2 
7 5 9 11 1 
6 8 10 2 
10 8 12 4 
1 5 3 7 
1 7 3 5 13 9 
7 3 5 11 9 
14 8 12 10 5 3 
-1
-1
3 1 7 9 5 
-1
-1
-1
11 5 1 9 7 
5 3 9 7 1 
10 4 6 8 2 
2 12 10 6 8 4 
4 12 8 6 10 
-1
-1
3 5 7 9 1 13 
6 2 ...

result:

ok Valid schedules (40011 test cases)

Test #7:

score: 0
Accepted
time: 109ms
memory: 9812kb

input:

33317
5
2 6
2 15
10 17
1 18
15 16
6
4 12
6 9
6 18
3 5
17 19
6 17
7
2 6
2 12
3 9
1 11
1 3
1 6
6 9
7
3 20
2 6
8 17
12 15
9 14
11 19
8 16
7
9 17
5 14
15 19
2 4
5 6
10 17
9 19
5
12 17
5 6
2 13
4 16
7 17
6
5 6
14 19
1 13
2 9
1 9
6 11
5
8 14
2 8
9 20
11 13
13 20
7
6 16
8 16
17 20
3 8
13 14
7 10
19 20
5
7 ...

output:

3 5 11 1 15 
5 7 11 3 17 9 
-1
4 2 14 12 10 16 8 
9 7 15 3 5 11 13 
13 5 3 7 9 
5 15 9 3 1 7 
9 2 13 11 15 
9 11 17 3 13 7 19 
7 15 11 9 4 
11 1 3 5 13 7 
2 8 14 6 4 
11 3 5 7 1 15 
8 6 10 4 15 17 2 
-1
19 11 7 3 5 1 
2 10 4 8 6 12 14 
6 4 17 12 19 8 2 
8 12 3 1 14 
9 19 17 7 13 
2 12 10 14 6 4 
7 3...

result:

ok Valid schedules (33317 test cases)

Test #8:

score: 0
Accepted
time: 70ms
memory: 9808kb

input:

30844
8
1 10
2 4
9 10
1 8
3 9
3 4
5 8
1 9
5
5 8
3 6
4 10
2 10
4 8
4
2 4
1 6
2 7
4 10
5
4 8
3 4
5 6
1 10
1 5
5
1 2
3 8
7 9
2 10
8 9
5
3 10
4 8
2 7
7 10
1 4
9
5 10
3 5
2 6
1 9
2 9
2 3
5 8
1 3
2 6
4
1 10
4 9
2 7
3 7
4
5 8
5 6
2 10
1 9
8
4 10
7 9
3 8
8 10
5 9
4 8
5 7
3 9
6
1 8
4 6
1 6
1 5
5 8
3 7
7
5 8
...

output:

-1
-1
3 1 5 7 
7 3 5 9 1 
-1
7 5 3 9 1 
-1
1 7 3 5 
7 5 3 1 
-1
-1
-1
6 4 8 2 
-1
-1
-1
-1
2 9 7 
-1
-1
-1
2 6 4 
5 3 9 1 
-1
-1
-1
-1
-1
1 3 5 
-1
5 1 7 
-1
-1
1 9 5 7 
-1
-1
-1
1 5 3 
-1
1 3 7 5 
-1
-1
-1
7 4 9 
-1
-1
-1
7 5 3 1 9 
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
5 3 1 
-1
-1
-1
1 7 3...

result:

ok Valid schedules (30844 test cases)

Test #9:

score: 0
Accepted
time: 87ms
memory: 9812kb

input:

30684
9
3 6
13 15
1 10
1 11
3 10
5 10
7 13
9 12
2 12
8
6 9
6 10
2 4
2 10
3 5
4 6
2 3
5 13
3
10 15
8 15
6 12
7
6 14
5 9
9 15
13 14
1 12
3 13
1 8
5
2 3
4 15
5 15
8 9
11 13
3
4 13
6 14
7 12
3
7 8
4 9
5 9
6
3 11
8 10
3 12
3 11
2 5
6 13
7
8 9
5 8
9 10
3 15
2 14
1 5
1 11
4
3 12
3 4
7 12
10 15
3
6 12
1 4
2...

output:

-1
-1
10 8 6 
9 5 11 13 3 7 1 
2 4 6 8 12 
4 6 8 
-1
4 8 10 6 2 12 
-1
5 3 7 11 
7 1 3 
-1
-1
-1
7 13 9 3 11 1 5 
2 7 5 9 
5 9 3 1 
-1
-1
-1
-1
-1
1 6 13 8 
13 3 7 9 11 5 
5 1 11 3 7 
-1
-1
8 4 2 6 
-1
14 3 5 12 10 
-1
-1
1 14 5 
3 10 12 5 
8 5 1 
-1
-1
10 4 12 6 8 14 
2 4 8 
-1
-1
-1
-1
8 2 6 12 10...

result:

ok Valid schedules (30684 test cases)

Test #10:

score: 0
Accepted
time: 104ms
memory: 9812kb

input:

30707
3
8 16
9 10
3 19
10
1 10
11 13
13 17
10 16
2 17
11 15
7 16
5 6
7 11
8 9
3
4 20
16 20
11 19
7
2 16
3 12
13 19
7 20
12 15
2 6
1 18
7
8 15
5 9
7 16
10 16
13 16
3 16
5 9
4
2 18
16 20
14 18
10 20
5
2 17
9 15
8 14
8 17
13 17
7
4 5
2 19
13 14
5 15
13 14
3 6
8 16
8
14 18
7 20
5 19
10 18
2 13
7 8
5 9
1...

output:

11 9 3 
-1
4 16 12 
7 5 15 9 13 3 1 
9 5 11 13 15 3 7 
2 16 14 11 
2 11 9 13 15 
-1
15 17 9 11 3 7 5 13 
7 9 5 
3 7 1 
-1
8 6 2 
3 7 19 5 9 11 
3 7 13 1 5 9 11 
11 3 9 17 15 19 5 1 13 7 
7 5 11 9 3 
8 10 3 12 
5 15 3 1 7 
-1
3 7 19 11 9 13 5 1 17 15 
8 4 2 
12 18 10 8 4 14 6 16 2 
17 12 10 5 
16 6 1...

result:

ok Valid schedules (30707 test cases)

Test #11:

score: 0
Accepted
time: 93ms
memory: 9808kb

input:

22169
9
7 8
7 17
4 20
7 12
2 4
14 19
4 10
2 16
10 17
6
6 8
8 12
4 8
9 19
14 17
2 18
13
9 17
3 12
10 16
9 12
2 5
3 13
6 10
10 13
12 14
14 15
15 18
16 20
9 11
7
6 9
4 11
5 7
2 5
3 13
4 13
10 18
6
16 17
3 17
2 19
5 16
10 14
5 15
9
11 16
4 18
12 20
14 20
1 7
16 18
4 17
5 19
9 17
10
2 8
1 14
2 18
10 17
5...

output:

7 13 19 9 3 17 5 11 15 
6 8 4 10 14 2 
-1
8 4 6 2 10 12 14 
16 4 2 8 10 6 
11 7 15 19 1 17 5 13 9 
-1
-1
1 11 9 15 17 5 3 
2 16 18 14 
-1
-1
-1
-1
-1
7 9 15 1 11 13 5 
14 5 7 
-1
-1
7 11 9 17 5 
9 17 11 
-1
-1
-1
-1
-1
10 6 8 2 12 4 16 
-1
-1
-1
-1
15 9 7 1 5 11 13 3 17 
6 8 10 4 2 
-1
-1
6 10 4 12 ...

result:

ok Valid schedules (22169 test cases)

Test #12:

score: 0
Accepted
time: 120ms
memory: 9808kb

input:

17323
16
13 29
14 16
3 12
21 32
2 33
10 33
3 9
34 40
19 35
26 35
18 21
22 23
8 32
12 32
6 31
34 40
10
7 10
34 37
28 31
7 33
9 26
19 26
29 32
6 31
16 25
23 34
17
8 35
1 26
4 10
16 31
13 22
23 34
3 37
30 32
7 33
21 30
22 26
8 25
13 28
6 9
9 22
9 11
2 40
3
6 30
1 18
13 18
9
5 11
19 33
20 27
24 27
14 40...

output:

16 14 6 24 2 20 4 34 26 28 18 22 10 12 8 36 
8 35 29 12 10 20 31 6 16 24 
29 1 5 19 13 27 3 31 25 21 23 15 17 7 11 9 33 
7 1 13 
6 23 21 25 15 10 29 19 4 
2 24 18 30 8 20 14 22 6 26 32 28 12 34 16 10 4 
33 9 13 3 7 11 15 1 17 5 31 
15 31 19 6 13 23 17 29 8 2 25 35 37 21 10 4 33 27 
13 29 35 17 25 23...

result:

ok Valid schedules (17323 test cases)

Test #13:

score: 0
Accepted
time: 130ms
memory: 9680kb

input:

12177
14
10 24
8 50
1 19
28 46
25 40
3 56
16 59
16 59
9 51
11 44
9 45
11 45
8 44
12 49
9
18 42
37 58
7 43
2 20
18 38
20 36
21 42
5 56
10 24
8
55 58
54 58
16 48
33 50
25 47
1 56
3 25
33 43
6
53 54
5 40
43 53
7 42
46 57
20 32
25
50 55
18 32
27 36
16 25
21 34
24 40
23 26
37 56
4 47
7 53
19 28
14 58
27 ...

output:

10 8 1 28 26 3 16 18 12 14 20 22 24 30 
22 37 8 2 18 20 24 6 10 
56 54 16 33 26 1 3 35 
53 6 43 8 47 21 
51 21 35 17 25 37 23 43 5 7 19 49 29 31 1 13 33 9 27 39 45 41 11 47 15 
11 35 21 49 17 33 47 37 15 9 27 31 2 4 13 25 23 19 
-1
26 20 8 30 12 10 46 32 14 34 38 42 2 6 24 50 18 28 48 36 22 4 16 40 ...

result:

ok Valid schedules (12177 test cases)

Test #14:

score: 0
Accepted
time: 135ms
memory: 9808kb

input:

9294
15
58 79
50 69
15 58
53 63
3 74
5 55
11 15
36 45
17 35
2 21
61 78
38 78
25 64
30 55
44 54
39
23 80
55 72
7 48
8 72
15 30
17 71
5 48
12 20
30 70
2 5
23 46
29 70
12 50
57 74
36 71
15 50
47 80
35 66
45 67
46 74
7 28
25 39
57 58
23 61
24 77
26 71
9 14
1 2
4 23
50 74
9 54
25 35
72 79
66 77
55 62
7 1...

output:

59 51 15 53 4 6 12 36 17 2 61 38 25 31 44 
75 59 17 61 15 47 19 13 41 3 23 43 29 63 51 31 77 39 45 65 11 27 57 35 69 53 9 1 5 67 33 25 73 71 55 7 37 21 49 
26 54 4 28 35 14 59 16 10 41 8 37 18 46 6 52 12 2 
17 23 33 11 38 
35 7 17 51 55 25 21 71 39 45 5 41 59 33 13 43 65 37 47 53 9 15 23 29 27 31 61...

result:

ok Valid schedules (9294 test cases)

Test #15:

score: 0
Accepted
time: 140ms
memory: 9812kb

input:

7519
43
53 66
4 96
51 76
5 27
19 51
6 99
23 40
74 94
15 44
23 56
86 91
28 53
37 90
52 93
31 33
30 49
41 92
12 20
77 99
13 75
48 77
12 45
46 51
7 41
32 52
27 56
31 60
1 74
5 79
9 82
11 12
5 29
41 89
60 98
17 33
79 95
14 68
42 43
33 43
13 63
8 62
47 52
18 43
19
53 75
17 92
50 70
30 94
31 81
11 87
21 5...

output:

54 78 60 5 26 84 24 76 16 38 86 28 70 74 32 30 72 14 88 58 62 22 46 9 36 40 44 1 64 66 11 7 68 82 18 80 56 42 34 52 50 48 20 
54 17 50 38 32 11 22 88 77 28 30 15 40 34 24 26 56 46 36 
8 75 23 32 10 21 
53 79 44 38 26 
82 42 10 18 48 30 68 34 84 66 70 8 90 22 12 6 16 50 36 28 4 24 20 38 2 54 40 60 62...

result:

ok Valid schedules (7519 test cases)

Test #16:

score: 0
Accepted
time: 202ms
memory: 9940kb

input:

1996
24
86 598
99 140
1 344
628 731
306 375
55 291
356 423
419 573
134 799
620 692
23 712
419 729
360 590
110 390
447 587
134 913
79 657
91 941
50 186
265 495
487 590
200 671
448 975
117 856
61
526 700
99 217
132 216
371 569
410 457
740 747
337 359
494 545
143 816
257 379
662 1000
888 990
244 910
25...

output:

87 100 1 629 306 56 357 420 134 620 24 422 360 110 448 136 79 91 50 266 488 200 450 118 
527 100 133 372 410 740 338 495 143 258 662 888 244 254 269 359 87 279 36 390 481 116 600 424 237 150 85 783 26 226 493 591 301 421 277 250 59 704 576 184 83 92 589 111 232 252 34 334 388 540 894 370 102 293 13 ...

result:

ok Valid schedules (1996 test cases)

Test #17:

score: 0
Accepted
time: 240ms
memory: 10928kb

input:

208
462
8802 9853
6755 7630
6279 7121
1757 5917
5767 9505
3815 6959
1723 7664
5641 6293
3715 4201
986 2197
3891 5659
913 5816
1685 7980
4016 9773
112 6287
1493 9638
2164 7990
4469 6073
1344 7859
3783 5912
3801 7713
5272 7457
774 3781
5278 7372
1801 6123
3686 7748
418 2709
4256 5434
4174 6445
2305 65...

output:

8803 6757 6280 1762 5768 3815 1724 5642 3716 986 3891 913 1686 4017 113 1493 2165 4469 1344 3783 3802 5272 775 5278 1802 3686 418 4256 4175 2306 5932 3473 5976 4149 1863 1328 2582 1656 3162 753 5505 2733 655 5040 5224 5706 1290 6692 2011 4782 6246 4625 7541 3740 1907 7552 6132 184 2845 1546 3390 370...

result:

ok Valid schedules (208 test cases)

Test #18:

score: 0
Accepted
time: 310ms
memory: 18896kb

input:

19
2769
32680 50143
36298 53385
17551 80993
4916 96505
20612 72661
21361 73134
45269 73502
18572 40384
46889 51157
57224 72952
27276 73349
64280 66390
9584 18848
14978 28973
65872 66617
58434 75613
18974 73703
16099 63152
14461 37982
25905 90822
46537 47016
15623 54587
36876 70526
12146 27017
77702 ...

output:

32681 36298 17552 4916 20613 21361 45270 18572 46889 57225 27277 64280 9585 14978 65873 58435 18977 16101 14462 25905 46537 15623 36876 12147 77702 23161 24469 57839 22000 8133 44319 3550 66786 15190 14040 58396 75962 27728 15454 7533 28525 70838 33983 38928 41054 1076 8483 56248 25342 45435 23333 3...

result:

ok Valid schedules (19 test cases)

Test #19:

score: 0
Accepted
time: 389ms
memory: 32164kb

input:

7
49453
73303 133761
70878 83502
285 193719
32429 143928
971 48118
23601 67888
9807 99900
33818 146007
138415 194070
174895 180756
4580 85434
110236 184566
18374 45047
18354 178112
24478 79705
94705 166592
107968 168537
20024 138355
170583 181920
39888 181365
16596 107299
82582 109867
44773 54862
18...

output:

73304 70878 404 32434 972 23602 9814 33820 138419 174895 4580 110236 18374 18366 24478 94708 107968 20024 170584 39888 16600 82582 44776 18710 86230 41592 80210 69566 45200 45920 1868 10230 29040 18430 36408 102412 5996 180466 78204 25698 76964 113482 87814 48678 66398 107864 45336 4606 141673 16761...

result:

ok Valid schedules (7 test cases)

Test #20:

score: 0
Accepted
time: 394ms
memory: 35716kb

input:

5
3538
64567 206572
221341 260487
42137 276255
190113 234239
5489 43714
131726 195290
42875 103293
229450 275537
290863 296669
31024 233198
131667 253945
73820 101905
156410 265901
31236 49977
61411 162791
249562 286149
19549 167528
163635 196271
116410 213942
77372 162420
17656 49614
35527 98402
13...

output:

64568 221342 42137 190113 5489 131727 42876 229450 290864 31024 131668 73821 156411 31236 61412 249563 19549 163635 116410 77373 17656 35528 138984 79639 81473 115063 83748 16367 147380 9903 85395 145547 110816 149176 55679 134703 166854 143688 95669 102957 15150 129858 127859 65548 90350 236217 773...

result:

ok Valid schedules (5 test cases)

Test #21:

score: 0
Accepted
time: 672ms
memory: 87212kb

input:

1
199999
666207 952718
266065 525310
679153 900733
157458 891103
191505 496106
298849 872359
345708 999308
24390 286298
558629 654446
337554 895213
705035 877047
160758 826972
5935 119784
35199 973880
254144 803824
80579 340826
437122 664725
875372 932327
365531 999922
7677 506012
633193 990771
7128...

output:

666208 266066 679154 157466 191506 298850 345711 24392 558629 337557 705036 160758 5936 35210 254148 80580 437123 875372 365531 7678 633194 712829 456157 501520 104452 575016 241952 97700 425263 476636 5076 476351 167832 441862 178878 151410 348050 13836 474368 334632 68020 48978 740169 263240 44603...

result:

ok Valid schedules (1 test case)

Test #22:

score: 0
Accepted
time: 306ms
memory: 70444kb

input:

1
200000
96201 191534
64043 107243
194520 231877
123324 246330
38611 187191
42082 120245
9411 47731
122421 149212
126588 154325
22106 268424
184282 228837
25171 205513
65439 187880
171530 241447
32964 143287
12396 160393
100 174882
7400 79500
9937 140570
13077 238862
221782 251971
55892 197543
17268...

output:

-1

result:

ok Valid schedules (1 test case)

Test #23:

score: 0
Accepted
time: 465ms
memory: 80192kb

input:

1
200000
212026 437809
383684 439421
19066 381799
72861 120247
96028 160342
129692 175308
57917 111831
32670 353707
99579 102105
114411 374760
241558 464138
120151 425821
179507 188621
422619 462196
293826 314604
117594 274238
338996 461706
268228 349167
473568 479197
89350 342047
188677 417663
9444...

output:

250519 383685 139361 72861 96029 129693 57917 77217 99579 125097 303523 226991 179507 422621 293827 117595 339001 268229 473569 89351 211339 99839 58735 87897 276885 55159 357619 193573 34511 280551 264657 176021 12123 133529 291415 92175 146137 153811 343571 141467 67839 446417 42553 44357 33611 12...

result:

ok Valid schedules (1 test case)

Test #24:

score: 0
Accepted
time: 604ms
memory: 86368kb

input:

1
200000
314839 586547
150074 588047
557594 571722
53618 573587
285242 403779
452972 504836
128027 146954
309785 712369
353681 420817
145794 656331
25881 307397
188386 501115
2334 733935
301423 442696
109848 497333
17545 425545
15224 599154
533343 632796
136923 600040
237420 411817
262523 663268
241...

output:

314839 150095 557595 53753 285245 452973 128027 309787 353681 145845 25885 188387 59375 301423 109855 17545 15263 533343 136923 237421 262525 24101 186667 120633 244391 23923 319503 245695 350849 219353 227835 516649 172463 17061 74147 472791 329753 306507 362071 484591 134205 333211 592701 318873 2...

result:

ok Valid schedules (1 test case)

Test #25:

score: 0
Accepted
time: 559ms
memory: 82880kb

input:

1
200000
248061 494228
88457 292570
227749 346825
128481 557695
408553 493979
281015 314394
59107 505690
437851 912551
564718 568902
548368 824358
213305 761301
182345 908657
672078 824881
557305 561073
23229 105568
520018 669100
265507 829401
661766 759522
201836 870255
303813 632983
81431 421633
4...

output:

248062 88458 227750 128482 408554 281016 59108 437855 564719 548369 213306 182366 672079 557306 23230 520019 265508 661766 201836 303814 81432 413016 253946 174614 463574 108230 588546 341548 335540 200358 226192 870092 628535 321808 593445 43530 113730 385325 711300 290878 342509 429286 459719 5904...

result:

ok Valid schedules (1 test case)

Test #26:

score: 0
Accepted
time: 90ms
memory: 9752kb

input:

66699
4
27629 959089
417747 841054
831132 962244
539977 731760
2
208335 793860
833153 868833
4
740936 791894
102137 678337
763178 858292
70628 611437
3
381865 732381
296775 846619
107414 471208
2
473935 937310
235151 532769
4
639792 944903
758543 894716
214300 367006
84082 841284
2
226688 284384
418...

output:

27629 417748 831133 539977 
208335 833154 
740936 102138 763179 70628 
381865 296776 107414 
473936 235151 
639792 758544 214301 84082 
226689 41827 
387113 70996 473673 318533 
131480 103869 577296 318966 
348129 452247 195843 
48040 522656 575726 
315936 52526 325038 816644 
4869 273283 491549 430...

result:

ok Valid schedules (66699 test cases)

Test #27:

score: 0
Accepted
time: 94ms
memory: 9804kb

input:

57172
3
1 12
1 2
1 12
4
5 11
1 6
5 12
2 4
3
1 7
3 10
4 11
2
1 12
4 11
3
1 10
3 10
3 8
2
2 7
3 6
5
1 9
3 7
4 6
4 12
4 9
2
3 11
1 8
4
1 12
1 9
1 6
3 11
4
6 11
5 6
2 7
1 9
5
9 12
1 11
1 9
7 12
1 10
3
4 8
1 6
5 11
5
1 10
2 7
4 10
1 8
7 10
2
3 12
2 4
3
2 6
5 7
1 8
5
5 10
1 11
1 8
1 10
2 10
2
4 8
2 9
2
5 ...

output:

3 1 5 
5 1 7 3 
1 3 5 
1 5 
1 5 3 
2 4 
1 3 5 9 7 
3 1 
7 3 1 5 
7 5 3 1 
9 5 1 7 3 
5 1 7 
5 3 7 1 9 
4 2 
3 5 1 
5 9 1 3 7 
4 2 
6 1 
1 5 7 9 3 
4 6 
3 1 
1 5 3 9 7 
3 1 7 5 
9 3 1 7 5 
1 6 
3 5 1 7 9 
3 7 9 5 1 
5 9 3 7 1 
1 5 7 3 9 
7 3 5 1 
5 9 1 7 3 
3 1 5 
6 1 
1 5 3 
1 3 7 9 5 
6 4 
8 1 6 
1...

result:

ok Valid schedules (57172 test cases)

Test #28:

score: 0
Accepted
time: 98ms
memory: 9808kb

input:

44461
3
1 6
1 3
4 10
5
4 14
1 13
1 7
5 10
4 12
5
5 12
1 10
1 13
3 9
1 7
3
6 9
1 9
3 6
3
2 9
1 7
3 6
4
3 9
6 11
1 6
2 9
5
7 12
9 12
1 10
3 4
1 6
5
2 13
2 13
1 11
3 7
3 12
4
1 6
1 14
2 14
1 7
4
5 8
5 13
1 10
5 7
3
1 12
3 12
2 5
6
2 12
8 14
3 10
1 13
2 10
1 9
6
1 14
7 13
1 8
5 14
2 7
1 7
3
2 8
3 10
2 6...

output:

3 1 5 
9 3 1 5 7 
7 5 9 3 1 
7 1 3 
5 1 3 
3 7 1 5 
7 9 5 3 1 
7 9 1 3 5 
1 5 7 3 
7 9 2 5 
1 5 3 
7 11 3 9 5 1 
9 7 5 11 3 1 
4 6 2 
1 7 3 5 9 11 
1 9 3 5 7 
1 5 9 7 11 3 
1 7 3 5 
6 8 2 4 
7 9 1 5 3 
9 7 3 5 1 
5 9 3 1 
5 9 7 11 1 3 
3 7 9 1 5 
9 7 5 3 1 
4 6 2 8 
9 11 1 3 7 5 
1 5 11 9 7 3 
3 1 5...

result:

ok Valid schedules (44461 test cases)

Test #29:

score: 0
Accepted
time: 98ms
memory: 9804kb

input:

36476
4
2 11
8 9
5 9
1 16
6
4 10
1 9
1 11
5 8
2 9
8 16
4
8 14
2 4
1 9
3 7
4
4 8
1 8
4 9
3 13
7
3 8
2 11
2 13
2 5
2 15
9 16
1 3
4
5 14
1 5
7 13
3 10
7
1 16
1 9
1 15
5 15
5 13
10 12
2 9
5
9 15
1 2
3 12
7 11
2 12
7
3 16
4 8
1 13
1 6
5 15
3 16
9 13
4
1 15
2 15
5 6
1 13
6
3 16
2 15
1 5
6 15
3 5
9 15
6
2 ...

output:

2 8 6 4 
7 1 9 5 3 11 
9 3 1 5 
5 1 7 3 
5 7 9 3 11 13 1 
5 1 7 3 
13 1 7 9 5 11 3 
9 1 3 7 5 
11 5 3 1 7 13 9 
1 3 5 7 
11 5 1 7 3 9 
3 9 11 5 7 1 
5 9 7 1 3 
5 7 1 3 
1 5 7 3 
3 1 9 5 7 
7 1 3 9 
7 3 1 9 5 
1 9 7 3 11 5 
5 7 3 11 9 1 
3 9 7 11 1 5 
5 1 3 9 7 
9 13 5 11 1 3 7 
9 5 7 1 3 13 11 
3 1 ...

result:

ok Valid schedules (36476 test cases)

Test #30:

score: 0
Accepted
time: 98ms
memory: 9680kb

input:

28544
7
5 11
6 17
4 12
4 13
1 17
4 15
3 12
8
8 18
7 14
6 17
2 16
5 11
2 13
1 8
1 12
7
1 15
3 13
2 16
6 11
7 20
1 8
6 15
6
2 12
1 10
1 11
3 19
8 20
5 20
9
1 11
2 17
2 15
1 12
11 20
13 19
3 4
1 9
3 10
9
3 18
1 12
1 17
1 8
8 17
6 15
13 16
2 20
10 18
9
10 18
3 12
5 12
7 17
1 17
2 15
6 15
7 19
1 18
8
2 4...

output:

5 13 7 9 1 11 3 
15 9 13 11 5 7 1 3 
5 3 11 7 13 1 9 
5 1 3 7 9 11 
7 13 11 9 17 15 3 1 5 
11 3 5 1 9 7 13 17 15 
13 3 5 11 1 7 9 17 15 
3 7 13 11 15 9 1 5 
1 5 3 7 9 
5 3 1 9 7 
5 11 13 3 7 1 9 
1 5 7 9 11 3 
7 5 9 1 3 11 
1 15 9 3 11 5 7 13 
9 11 7 1 13 15 3 5 
11 1 7 3 9 5 13 
5 1 3 7 9 11 13 
1 ...

result:

ok Valid schedules (28544 test cases)

Test #31:

score: 0
Accepted
time: 106ms
memory: 9812kb

input:

13360
20
4 31
20 31
9 27
30 40
25 34
24 36
27 41
19 41
10 35
10 21
3 36
23 36
1 32
4 21
5 37
3 15
15 32
5 27
35 38
3 29
20
31 35
1 29
15 29
7 25
35 37
1 29
5 21
18 31
9 42
3 31
5 41
21 38
28 35
2 24
4 41
4 16
13 29
9 41
4 23
19 42
13
3 29
6 25
5 19
4 15
2 17
4 29
12 21
4 37
13 30
6 37
18 30
1 41
10 ...

output:

15 21 9 33 25 27 37 39 19 11 23 29 1 5 31 3 17 7 35 13 
31 1 15 11 35 13 7 19 37 21 25 23 29 3 27 5 17 33 9 39 
15 9 7 5 3 17 13 23 19 25 21 1 11 
25 19 27 3 7 13 29 9 5 17 21 11 15 1 23 
7 9 5 19 11 15 1 3 13 17 
19 17 5 21 23 1 15 3 7 9 13 11 
13 1 19 5 17 21 15 11 9 7 3 23 
5 11 9 13 3 15 17 1 7 ...

result:

ok Valid schedules (13360 test cases)

Test #32:

score: 0
Accepted
time: 143ms
memory: 9744kb

input:

3314
88
113 121
110 179
29 134
8 136
10 180
50 187
4 200
15 174
51 132
9 66
16 169
39 200
56 176
7 40
97 181
104 166
3 114
18 189
43 107
48 183
113 184
11 160
18 61
104 134
15 101
51 193
24 49
36 171
2 125
88 115
8 81
55 182
7 199
53 136
49 159
49 67
75 174
30 71
4 152
70 200
20 74
18 195
131 192
10...

output:

113 119 55 57 123 137 171 99 51 9 91 173 111 7 125 107 33 141 43 129 135 83 19 105 27 145 25 97 39 89 13 127 163 59 81 49 101 31 67 175 23 153 143 109 165 73 157 147 131 3 65 103 37 93 151 87 45 95 21 35 11 79 161 121 155 133 139 5 29 115 167 169 69 117 53 15 77 159 17 149 1 71 61 41 85 75 47 63 
3 ...

result:

ok Valid schedules (3314 test cases)

Test #33:

score: 0
Accepted
time: 183ms
memory: 10348kb

input:

387
955
413 1866
243 1214
202 1969
216 1988
73 741
126 1666
63 1707
1677 1958
430 1836
895 1486
711 1444
26 1053
165 1044
1616 1674
306 1580
1521 1698
1020 1766
262 1086
329 691
71 1599
21 782
654 1789
133 1349
423 1513
135 1906
19 1821
1315 1830
179 1877
366 1481
70 1403
6 1845
937 2000
113 1613
24...

output:

1421 299 1787 1855 73 935 1009 1735 1317 895 711 133 171 1617 767 1521 1151 263 329 803 33 1195 417 667 1529 1279 1315 1437 631 499 1355 1901 829 287 847 1613 149 399 885 609 1757 835 855 605 1797 687 157 1805 617 1189 1755 1005 201 377 1895 79 709 1849 1161 1325 1183 1003 869 533 913 1293 1337 1259...

result:

ok Valid schedules (387 test cases)

Test #34:

score: 0
Accepted
time: 210ms
memory: 15464kb

input:

33
2933
1368 16952
5280 16566
2652 11887
10035 12268
1548 11337
100 495
4636 14619
1376 17631
2176 18183
6361 15482
1736 11724
3384 15583
8 9682
987 18640
5081 19982
1035 11699
829 17812
572 17013
3217 8690
4682 10580
4460 15877
2776 13450
2240 19194
4053 19668
2344 6281
485 13832
938 12002
7186 166...

output:

1369 5281 2659 10035 1551 101 4637 1377 2177 6361 1737 3385 11 991 5081 1035 837 743 3217 4683 4461 2777 2241 4053 2345 749 939 7187 751 753 4253 1645 1155 10574 11023 5073 3349 1021 1791 8542 5345 235 767 513 163 2645 757 873 761 1 765 3121 2407 893 7962 1447 13662 831 6217 4877 503 405 561 1581 58...

result:

ok Valid schedules (33 test cases)

Test #35:

score: 0
Accepted
time: 277ms
memory: 33524kb

input:

3
61998
14069 145627
24631 144561
8736 57795
20150 193017
7236 170581
47616 93168
41304 195341
680 123958
44227 195363
53571 140979
7045 60469
24912 97853
1179 60801
36637 148430
19743 54827
169 165243
32390 153757
17935 186101
58772 100328
18939 152065
2779 182740
2981 9159
47472 130091
13777 18551...

output:

63793 62555 8739 109865 93253 47617 109871 39813 109873 58441 7047 24913 2681 66995 19743 86869 73419 109875 58773 71457 106387 2981 47481 109365 68491 74343 98991 96017 99861 106273 39875 83199 23323 76311 94467 20311 16715 29005 5231 25831 109877 55169 109879 19541 105333 76799 82797 17101 33873 5...

result:

ok Valid schedules (3 test cases)

Test #36:

score: 0
Accepted
time: 259ms
memory: 55080kb

input:

1
135234
85512 209169
189226 278946
62760 307609
6885 169772
83503 397703
4639 285739
207376 360410
19548 169381
50364 143928
62166 339294
6040 242927
177905 363720
83421 274195
120403 303625
54605 145905
43993 125786
22770 254386
4292 383447
11707 162514
120798 273484
32451 306093
136250 213900
202...

output:

85513 189227 152733 21445 267843 123959 223299 21247 50365 195779 74677 227563 109191 147297 54605 43995 86633 251515 18045 120801 150839 136251 20293 151305 152019 198409 80299 197235 218261 13345 212317 184203 219555 170981 159509 204405 52759 231857 42659 226197 80369 71959 131679 188001 234699 1...

result:

ok Valid schedules (1 test case)

Test #37:

score: 0
Accepted
time: 380ms
memory: 71404kb

input:

1
195939
61071 372393
45305 399328
74041 363710
235664 252319
23056 386144
85337 372890
31967 359799
6654 254335
2133 324087
12406 387073
335 144719
137527 368350
58272 322108
321920 390918
22112 378967
36688 82650
2231 277651
159551 397599
13749 192736
95467 393745
6664 391933
56040 132529
56492 18...

output:

294709 389181 271063 235665 338093 296031 261065 85715 185245 341389 11763 283607 181851 355815 314449 36689 113567 382341 34397 366817 359827 56041 56493 375323 165049 389429 289203 327213 36363 273653 248863 345731 112609 361705 53119 183389 146527 84723 15855 293661 269529 341753 217283 281721 27...

result:

ok Valid schedules (1 test case)

Test #38:

score: 0
Accepted
time: 388ms
memory: 74040kb

input:

1
199999
106449 251696
76616 262687
97217 338902
58380 380547
94492 316012
109531 392825
246413 344535
16657 35258
69722 316567
61129 381465
9671 369100
110607 245704
25445 397502
11881 348493
304136 397954
86892 381967
81356 329422
128170 389159
29632 172656
98378 388670
95197 286189
183541 245815
...

output:

106451 94925 214283 319429 171049 363311 246413 16659 172097 322389 285489 110611 384743 235263 387057 324089 195833 349021 29633 347255 124445 183541 244177 19695 121331 392525 165701 267391 66225 382779 333777 10943 398369 351213 387553 241171 381073 10311 240249 158139 73027 2603 147005 166915 32...

result:

ok Valid schedules (1 test case)

Test #39:

score: 0
Accepted
time: 395ms
memory: 75840kb

input:

1
200000
102943 390699
49394 358426
270755 384555
52799 227296
88093 340705
128995 364966
136352 359097
1013 126358
154135 353021
85576 203812
321855 368556
226434 305723
14121 150109
160674 226395
9876 284046
130691 354714
13299 42076
255161 316201
233998 319770
132156 284042
6204 141266
271185 317...

output:

354639 258529 332483 60057 218301 275053 260197 6341 245657 85577 321855 226435 14125 160675 121713 249575 13299 255161 233999 132157 10613 271185 132219 125557 243849 351861 69845 203183 286687 301607 165901 54961 116753 321763 189599 141515 55445 177329 274769 258273 221061 254153 187695 97673 146...

result:

ok Valid schedules (1 test case)

Test #40:

score: 0
Accepted
time: 429ms
memory: 82840kb

input:

1
200000
423669 939935
126496 938281
75834 353068
206313 620378
91654 858602
27239 207128
21974 766776
49222 364553
98606 690988
296638 689902
109647 800954
361150 840841
92553 984099
468742 875457
35090 677204
76715 505858
128788 491021
123978 409231
190237 661631
300071 707065
11664 820092
246934 ...

output:

423669 126497 75835 206313 91659 27239 74847 49223 98607 296641 109647 361151 92569 468743 74849 76717 128789 123979 190239 300071 74851 246935 162947 86213 13375 74853 101119 253287 52941 31237 187725 74855 128937 85185 6369 65819 148605 384539 369185 79217 68449 114269 74861 204897 163163 230467 1...

result:

ok Valid schedules (1 test case)

Test #41:

score: 0
Accepted
time: 268ms
memory: 64032kb

input:

1
200000
2 3
999999 1000000
1 5
1 7
1 9
1 11
1 13
1 15
1 17
1 19
1 21
1 23
1 25
1 27
1 29
1 31
1 33
1 35
1 37
1 39
1 41
1 43
1 45
1 47
1 49
1 51
1 53
1 55
1 57
1 59
1 61
1 63
1 65
1 67
1 69
1 71
1 73
1 75
1 77
1 79
1 81
1 83
1 85
1 87
1 89
1 91
1 93
1 95
1 97
1 99
1 101
1 103
1 105
1 107
1 109
1 111...

output:

2 999999 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 60 62 64 66 68 70 72 74 76 78 80 82 84 86 88 90 92 94 96 98 100 102 104 106 108 110 112 114 116 118 120 122 124 126 128 130 132 134 136 138 140 142 144 146 148 150 152 154 156 158 160 162 164 166 168 170 172 17...

result:

ok Valid schedules (1 test case)

Test #42:

score: 0
Accepted
time: 282ms
memory: 62868kb

input:

1
200000
999998 999999
1 2
999996 1000000
999994 1000000
999992 1000000
999990 1000000
999988 1000000
999986 1000000
999984 1000000
999982 1000000
999980 1000000
999978 1000000
999976 1000000
999974 1000000
999972 1000000
999970 1000000
999968 1000000
999966 1000000
999964 1000000
999962 1000000
999...

output:

999998 1 999996 999994 999992 999990 999988 999986 999984 999982 999980 999978 999976 999974 999972 999970 999968 999966 999964 999962 999960 999958 999956 999954 999952 999950 999948 999946 999944 999942 999940 999938 999936 999934 999932 999930 999928 999926 999924 999922 999920 999918 999916 9999...

result:

ok Valid schedules (1 test case)

Test #43:

score: 0
Accepted
time: 221ms
memory: 10384kb

input:

385
382
482 491
700 710
716 741
608 610
720 734
748 754
298 309
313 320
445 446
313 326
250 259
693 695
156 160
801 802
371 372
214 227
560 572
566 574
66 69
234 237
597 600
516 533
13 17
358 361
128 138
406 410
718 726
427 436
72 78
456 459
597 599
774 781
818 830
179 197
338 346
750 753
222 227
12...

output:

482 705 716 609 722 749 308 313 445 319 251 694 157 801 371 214 563 567 67 234 599 525 14 358 129 408 718 433 74 456 597 779 827 180 338 751 222 139 654 292 109 569 829 656 450 620 588 137 186 306 766 355 484 78 380 323 586 28 8 773 278 448 5 89 212 1 775 399 374 182 637 618 105 220 477 30 94 12 178...

result:

ok Valid schedules (385 test cases)

Test #44:

score: 0
Accepted
time: 250ms
memory: 14488kb

input:

34
4547
2808 2809
9509 9510
6651 6654
7990 7991
10234 10235
883 890
3755 3761
241 247
4413 4414
11779 11780
4040 4041
6339 6346
77 78
4188 4189
318 319
6273 6274
4842 4843
4762 4765
1147 1149
7420 7421
10110 10114
8184 8185
11852 11853
6861 6862
269 271
2360 2361
1330 1332
11583 11585
5151 5160
7845...

output:

2808 9509 6651 7990 10234 887 3758 243 4413 11779 4040 6341 77 4188 318 6273 4842 4764 1148 7420 10110 8184 11852 6861 270 2360 1331 11584 5155 7845 3400 1217 7074 10135 399 8145 1786 5250 6850 5115 10837 6953 4612 9878 7730 2671 8547 10293 113 6438 1742 2590 10991 10807 11638 9078 3580 1307 4035 10...

result:

ok Valid schedules (34 test cases)

Test #45:

score: 0
Accepted
time: 480ms
memory: 85344kb

input:

1
199413
404106 404111
476048 476050
299317 299318
472623 472624
266868 266869
375895 375896
306695 306696
403388 403389
540688 540690
52482 52483
194745 194748
170110 170111
522971 522972
446725 446727
6455 6456
543113 543114
189880 189881
47998 47999
211170 211171
460955 460956
114799 114802
47476...

output:

404106 476048 299317 472623 266868 375895 306695 403388 540689 52482 194745 170110 522971 446725 6455 543113 189880 47998 211170 460955 114801 474761 215966 43673 184512 530227 142680 269698 547180 287837 297483 369026 494088 516734 72942 385195 351289 290303 290170 329148 272807 328610 405362 36007...

result:

ok Valid schedules (1 test case)

Test #46:

score: 0
Accepted
time: 488ms
memory: 88908kb

input:

1
200000
318474 318475
466455 466456
119384 119385
555911 555912
300628 300629
43630 580223
540350 540351
477173 477174
222161 222162
300268 300269
501798 501799
580124 580125
470762 470763
119056 119057
71286 71287
48601 48602
158772 158773
578287 578288
77497 77498
1 180995
534437 534438
11500 115...

output:

318474 466455 119384 555911 300628 293528 540350 477173 222161 300268 501798 580124 470762 119056 71286 48601 158772 578287 77497 86614 534437 11500 5947 503785 259921 178396 543401 134483 505414 33836 153957 437355 428255 505914 206794 187711 258919 254129 165124 211380 79102 475186 529305 207474 3...

result:

ok Valid schedules (1 test case)

Test #47:

score: 0
Accepted
time: 99ms
memory: 9748kb

input:

23075
10
4 12
6 14
1 4
12 17
7 17
15 19
2 11
3 19
4 16
5 17
9
11 18
5 14
6 20
1 20
6 16
6 19
1 15
5 8
3 4
10
9 19
12 17
3 18
17 20
10 19
6 11
2 8
5 15
1 19
9 12
8
12 19
5 13
5 12
1 3
5 9
5 15
11 16
10 13
6
13 19
3 5
1 10
17 19
1 2
14 15
9
12 16
17 19
1 17
8 14
1 13
1 10
8 17
10 16
9 18
9
1 2
8 10
1 ...

output:

-1
11 7 15 17 9 13 1 5 3 
15 13 11 19 17 7 3 5 1 9 
17 9 7 2 5 13 15 11 
16 3 5 18 1 14 
12 18 6 8 4 2 14 10 16 
1 9 3 13 15 7 5 11 17 
-1
-1
-1
6 12 14 18 8 2 4 10 16 
15 17 7 11 13 1 9 3 19 5 
11 7 13 1 9 5 15 17 
9 5 13 1 7 15 3 11 
-1
-1
-1
-1
15 13 9 19 7 11 17 5 
18 16 12 1 3 14 
6 4 13 2 15 
...

result:

ok Valid schedules (23075 test cases)

Test #48:

score: 0
Accepted
time: 139ms
memory: 9820kb

input:

2719
74
30 71
69 117
17 58
10 55
32 51
17 97
14 77
3 51
39 110
50 86
97 139
14 102
32 141
101 120
70 116
21 93
19 123
44 135
25 134
97 131
62 74
122 147
48 60
74 81
21 24
79 147
35 71
51 115
67 85
58 131
46 89
122 135
68 86
11 81
36 117
85 130
26 134
101 140
45 51
43 110
125 133
85 132
29 77
28 78
2...

output:

31 93 17 11 33 71 15 7 77 59 133 73 137 101 91 41 97 127 121 115 63 143 51 75 21 145 35 87 67 117 61 129 69 39 95 111 123 135 45 79 125 119 29 37 25 99 19 3 147 89 113 5 131 83 107 65 23 85 53 105 55 103 109 9 81 13 49 139 47 1 57 141 27 43 
19 21 135 29 53 121 27 7 47 43 75 49 35 129 67 81 23 11 11...

result:

ok Valid schedules (2719 test cases)

Test #49:

score: 0
Accepted
time: 188ms
memory: 10100kb

input:

200
998
464 962
132 1570
673 1253
1410 1783
527 735
440 540
1147 1720
770 897
634 1133
229 1812
564 1815
710 1291
63 555
409 451
6 250
819 956
19 1007
486 672
662 838
1946 1950
603 1421
587 807
15 1635
441 1653
7 1753
641 998
1826 1908
348 656
770 1473
467 835
234 1668
235 1145
1008 1825
918 1554
70...

output:

465 1173 673 1617 527 445 1509 771 635 1665 1677 711 63 409 9 819 21 487 663 1947 897 587 1305 1361 1555 641 1851 349 1001 467 1389 395 1703 1115 1659 197 1777 539 1371 923 1177 265 181 1593 991 1427 1435 1191 1885 1103 1303 1519 1425 731 1609 19 187 879 201 631 1619 1679 757 1447 607 1211 485 1927 ...

result:

ok Valid schedules (200 test cases)

Test #50:

score: 0
Accepted
time: 240ms
memory: 15484kb

input:

13
15000
7187 8339
4463 21969
4913 27669
1848 16884
9501 16970
1509 21005
7507 11009
20687 26510
9930 25771
5826 12093
14367 26319
10001 14183
12265 28524
4190 7068
2952 25781
4044 8755
24252 27826
2347 16429
7940 29175
3000 16227
7078 14466
1973 21972
3334 15774
807 4802
16026 24029
3928 24955
1186...

output:

-1
-1
-1
14818 23420 16166 4016 26936 24238 758 3830 28070 1502 2830 14134 1772 22664 4678 18662 4042 5436 26238 9732 16338 21312 21462 13132 6856 20056 9596 16608 6654 18464 18216 17098 18384 28990 24372 1398 19146 21574 9240 9690 11044 22876 21932 15016 7754 27748 25702 18822 3194 22780 29832 1849...

result:

ok Valid schedules (13 test cases)

Test #51:

score: 0
Accepted
time: 515ms
memory: 87280kb

input:

1
199999
468606 468610
395174 395184
184570 184573
580180 580183
241532 241533
403838 403839
327612 327617
484988 484990
172838 172841
55834 55839
334086 334088
182237 182242
175997 176004
256516 256522
404520 404528
7149 7152
317715 317721
337105 337111
581487 581488
362335 362340
506378 506383
533...

output:

468609 395174 184570 580181 241532 403838 327613 484989 172838 55836 334086 182238 175999 256516 404521 7149 317719 337106 581487 362335 506379 533037 271632 55141 274598 554654 244410 180113 307479 149440 461490 10123 373482 559906 31178 511018 451015 417541 353693 293140 111580 564948 53553 273476...

result:

ok Valid schedules (1 test case)

Test #52:

score: 0
Accepted
time: 469ms
memory: 80184kb

input:

1
200000
333465 333473
374187 374192
266212 266227
272 279
145788 145795
67140 67145
148293 148304
403265 403277
137874 137881
227490 227496
204085 204091
266887 266895
51622 51631
20500 20510
94723 94736
113574 113580
97253 97266
209664 209684
395693 395696
183162 183169
23385 23394
128064 128067
4...

output:

333468 374190 266221 272 145789 67141 148301 403272 137874 227490 204089 266888 51625 20507 94732 113575 97256 209680 395693 183163 23387 128064 423983 294295 82126 376058 254870 215741 134831 137 229016 107410 163298 460968 63897 204926 464302 61303 19744 329473 182737 426937 344738 49614 435227 17...

result:

ok Valid schedules (1 test case)

Test #53:

score: 0
Accepted
time: 478ms
memory: 82100kb

input:

1
199996
256679 256692
316343 316348
441042 441046
445620 445628
52911 52923
327845 327855
160480 160486
254912 254922
112048 112061
360106 360115
230815 230828
79007 79014
57997 58011
345321 345323
341739 341746
265847 265860
262544 262548
110029 110041
179931 179939
279089 279097
382768 382778
772...

output:

256689 316345 441042 445621 52913 327850 160480 254913 112058 360107 230823 79008 58002 345321 341741 265852 262544 110034 179931 279090 382773 77293 361323 57894 269811 185236 1069 413176 492379 260487 191866 283497 389161 2505 436414 4767 302273 316317 103005 56966 60714 434477 49699 165686 358529...

result:

ok Valid schedules (1 test case)

Test #54:

score: 0
Accepted
time: 441ms
memory: 72456kb

input:

1
199947
200342 200397
216263 216303
197263 197269
378306 378322
13893 13960
330356 330382
171779 171818
122587 122673
260220 260375
222053 222070
173381 173411
292586 292691
404987 405080
242527 242621
335104 335134
10802 10838
60258 60344
378949 378999
244917 244952
129803 129838
183956 184054
157...

output:

200363 216273 197263 378308 13931 330357 171780 122608 260315 222058 173382 292632 405006 242598 335105 10803 60293 378952 244930 129809 184012 157840 253736 397314 401450 346613 178520 310172 286170 78843 339802 172702 221996 155142 268409 2384 144615 151830 182634 19499 150981 24237 241988 93624 2...

result:

ok Valid schedules (1 test case)

Test #55:

score: 0
Accepted
time: 429ms
memory: 75048kb

input:

1
199984
178925 179044
290979 291074
189552 189627
335158 335237
131026 131099
362401 362494
267560 267636
285915 285950
244749 244823
112816 112906
117151 117207
368517 368665
234293 234378
212729 212802
284147 284270
280469 280580
311795 311856
10772 10836
259171 259242
51614 51630
201926 202065
1...

output:

178992 290995 189562 335184 131028 362426 267615 285915 244749 112832 117157 368604 234294 212793 284258 280516 311796 10809 259217 51615 202045 101242 298087 93043 318736 278768 176546 409534 276775 60797 157705 290019 399426 226050 267873 177568 108195 24617 334082 12217 261855 153492 152804 23124...

result:

ok Valid schedules (1 test case)

Test #56:

score: 0
Accepted
time: 454ms
memory: 74872kb

input:

1
199978
382143 382157
348886 348909
362565 362605
137267 137329
324984 325058
275115 275172
21308 21324
240764 240808
305608 305709
140585 140607
239272 239376
30153 30228
324844 324937
287994 288072
165241 165370
95235 95262
15526 15626
246875 247001
279875 279895
182913 182952
338792 338844
25302...

output:

382144 348886 362565 137270 324984 275118 21308 240773 305627 140586 239362 30171 324866 288017 165304 95235 15554 246964 279876 182913 338804 253035 247324 273572 11687 123453 58408 171007 249604 179913 165088 362647 391420 299636 9517 232217 85244 97327 398278 315526 160168 195704 295344 265481 25...

result:

ok Valid schedules (1 test case)

Test #57:

score: 0
Accepted
time: 448ms
memory: 76116kb

input:

1
199980
46740 46806
311175 311283
283666 283800
429228 429244
11102 11123
299554 299561
99328 99379
78451 78577
288254 288314
123235 123317
25210 25240
136513 136530
12926 13068
408481 408508
322347 322390
8734 8759
429174 429258
229309 229403
204817 204926
275774 275793
125023 125118
422119 422246...

output:

46750 311222 283739 429229 11103 299554 99355 78529 288291 123277 25211 136513 13016 408488 322349 8735 429227 229345 204834 275774 125024 422144 404294 106487 130247 276038 17905 204854 211013 342625 401568 422074 198068 297409 181144 392205 239878 343793 71768 14188 392301 54483 44774 184692 22426...

result:

ok Valid schedules (1 test case)

Test #58:

score: 0
Accepted
time: 427ms
memory: 72624kb

input:

1
199888
366369 367222
335264 335612
301818 302504
23191 23809
137886 139068
380899 381168
128313 129141
133361 133541
186018 186352
225002 225582
125547 126610
78083 78997
385199 385984
309874 310428
291843 291981
122077 122473
391695 393175
165762 167258
217711 218139
373330 373447
155644 155941
1...

output:

367207 335265 302079 23191 138933 380899 128917 133361 186091 225341 126213 78576 385367 309935 291939 122143 392777 167027 218051 373331 155647 129519 221935 175193 67841 391643 38389 342849 314791 365547 15187 264501 387043 32831 191287 224611 368375 328745 328495 46481 33941 294323 385309 7021 22...

result:

ok Valid schedules (1 test case)

Test #59:

score: 0
Accepted
time: 365ms
memory: 71516kb

input:

1
193507
136382 147645
33644 35694
214662 227811
279666 287602
314959 320722
116242 121006
352208 355871
53693 63847
51532 63642
90797 93694
97427 98846
64908 66505
17349 26283
99459 115017
377261 385871
135676 145648
102471 113956
56085 57433
120799 127866
189573 204276
168848 173916
191654 205233
...

output:

142105 34893 227163 281907 316317 116243 355175 61223 60621 91323 98423 64909 22275 113561 381677 138681 110171 56085 122377 201189 170385 204907 17391 322283 112035 378117 240509 46277 215999 272587 23119 219411 272883 270669 174439 238221 99563 116029 40757 109873 242995 317931 343481 224573 55171...

result:

ok Valid schedules (1 test case)

Test #60:

score: 0
Accepted
time: 393ms
memory: 65344kb

input:

1
200000
28461 371541
133466 266535
190243 209759
23338 376663
115789 284213
116513 283489
70606 329395
113803 286199
27638 372363
57016 342985
106582 293419
53423 346579
103841 296161
8299 391703
116484 283517
3919 396083
162890 237111
94649 305353
34860 365141
145461 254541
75431 324571
12823 3871...

output:

371540 133466 209758 23338 284212 283488 70606 286198 27638 57016 106582 346578 296160 391702 116484 396082 162890 305352 34860 254540 324570 387178 175282 394980 319132 215728 159180 168282 213096 52160 276890 399390 124138 318046 84558 210326 357262 211276 116638 375000 335966 29852 190532 196032 ...

result:

ok Valid schedules (1 test case)

Test #61:

score: 0
Accepted
time: 397ms
memory: 66560kb

input:

1
200000
224141 575861
333522 466479
303513 496489
227801 572201
323833 476169
360181 439821
249247 550755
298292 501709
295177 504825
307730 492271
232537 567465
362404 437597
313006 486995
205200 594801
325817 474185
283110 516891
310078 489923
271171 528831
258633 541369
363911 436091
314945 4850...

output:

575860 333522 496488 572200 476168 439820 550754 298292 504824 307730 567464 362404 313006 205200 474184 283110 310078 528830 541368 436090 485056 553120 204418 276326 287744 461428 545106 486038 333716 540156 257490 475818 230910 554812 368622 479074 278468 584190 443934 564684 500754 465910 280454...

result:

ok Valid schedules (1 test case)

Test #62:

score: 0
Accepted
time: 399ms
memory: 65228kb

input:

1
200000
331394 468607
298830 501171
241162 558839
256250 543750
362490 437510
206456 593545
350828 449173
233840 566160
345690 454310
209818 590183
287070 512931
336342 463659
347698 452303
371556 428445
213078 586922
344018 455982
313342 486658
271374 528626
327740 472261
331514 468487
367862 4321...

output:

468606 501170 558838 256250 362490 593544 449172 233840 345690 590182 512930 463658 452302 428444 213078 344018 313342 271374 472260 468486 432138 377048 422532 570364 305116 407286 272982 503678 292890 590488 285600 571704 345784 510228 351540 213630 318886 273438 387322 399866 595906 286952 476256...

result:

ok Valid schedules (1 test case)

Test #63:

score: 0
Accepted
time: 261ms
memory: 63296kb

input:

1
200000
317644 482358
330806 469195
243284 556717
255640 544362
358520 441481
321378 478624
371202 428799
206832 593170
266420 533582
202762 597239
270946 529056
339504 460497
215352 584649
383502 416499
360368 439633
292334 507667
223984 576018
212306 587696
319480 480521
335788 464213
267284 5327...

output:

-1

result:

ok Valid schedules (1 test case)

Test #64:

score: 0
Accepted
time: 266ms
memory: 65268kb

input:

1
200000
327643 472357
318853 481147
316097 483903
331968 468033
345007 454993
395401 404599
337346 462655
393115 406885
374820 425181
289411 510589
285781 514219
201977 598023
376572 423429
204879 595121
279647 520353
389407 410593
241603 558397
306557 493443
388868 411133
349721 450279
338190 4618...

output:

-1

result:

ok Valid schedules (1 test case)

Test #65:

score: 0
Accepted
time: 151ms
memory: 53304kb

input:

1
200000
400000 400001
400000 400001
400000 400001
400000 400001
400000 400001
400000 400001
400000 400001
400000 400001
400000 400001
400000 400001
400000 400001
400000 400001
400000 400001
400000 400001
400000 400001
400000 400001
400000 400001
400000 400001
400000 400001
400000 400001
400000 4000...

output:

-1

result:

ok Valid schedules (1 test case)

Test #66:

score: 0
Accepted
time: 231ms
memory: 57200kb

input:

1
200000
348344 451657
358881 441120
352537 447464
388331 411670
370433 429568
381741 418260
382277 417724
372136 427865
364479 435522
337473 462528
321286 478715
308475 491526
338600 461401
329143 470858
306771 493230
385019 414982
355132 444869
383065 416936
309639 490362
384953 415048
354247 4457...

output:

-1

result:

ok Valid schedules (1 test case)

Test #67:

score: 0
Accepted
time: 394ms
memory: 64316kb

input:

1
200000
292612 507389
304404 495595
256074 543925
303366 496633
365788 434211
248436 551565
283398 516601
381430 418571
239186 560813
307776 492223
266456 533545
376298 423703
357228 442773
365344 434657
204512 595487
374494 425505
312812 487189
285296 514705
297184 502815
309688 490313
348442 4515...

output:

507388 304404 256074 303366 365788 551564 283398 418570 239186 307776 533544 423702 442772 434656 204512 374494 487188 514704 297184 490312 451558 309574 472508 215154 529716 585608 531458 581704 467084 563452 324388 303496 388938 389744 560054 320988 379532 341784 266738 515878 563988 309242 291104...

result:

ok Valid schedules (1 test case)

Test #68:

score: 0
Accepted
time: 396ms
memory: 60000kb

input:

1
200000
298862 501139
271606 528395
301634 498367
203344 596657
207188 592813
219088 580913
235124 564877
397968 402033
355116 444885
208458 591543
217404 582597
376444 423557
294858 505143
274404 525597
344278 455723
295028 504973
302572 497429
319758 480243
219298 580703
260356 539645
317810 4821...

output:

298862 271606 301634 203344 207188 219088 235124 397968 355116 208458 217404 376444 294858 274404 344278 295028 302572 319758 219298 260356 317810 354150 262316 308370 293260 337798 331690 348026 268850 306844 331324 320230 327148 303860 265912 305954 229758 396126 253656 352206 229052 370944 337526...

result:

ok Valid schedules (1 test case)

Test #69:

score: 0
Accepted
time: 404ms
memory: 62652kb

input:

1
200000
390670 409331
313620 486383
335596 464405
246758 553243
374034 425967
217946 582057
343146 456855
257526 542475
254042 545961
280766 519237
278866 521137
359822 440181
318870 481133
290004 509999
331140 468863
359250 440753
327942 472061
251972 548031
349026 450977
223432 576571
386486 4135...

output:

390670 486382 335596 246758 374034 582056 343146 257526 545960 519236 521136 440180 481132 509998 468862 440752 472060 548030 450976 576570 413516 269536 239332 445912 263864 225712 371416 402204 225854 428102 327028 203142 332752 525926 570542 577318 466944 395856 421960 445706 306774 249916 473530...

result:

ok Valid schedules (1 test case)