#pragma GCC optimize("Ofast")
#pragma GCC optimize("O3,unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#define f0r(i, n) for (auto i = 0; i < (n); ++i)
#define fnr(i, n, k) for (auto i = (n); i < (k); ++i)
#define all(v) (v).begin(), (v).end()
#define pb push_back
#define F first
#define S second
#define ctn(x) cout << x << '\n'
#define forl(a, l) for (auto a : l)
#define ctl(l) for (auto &a : (l)) cout << a << ' '; cout << endl;
#define lb(v, x) (lower_bound(all(v), x) - begin(v))
#define ub(v, x) (upper_bound(all(v), x) - begin(v))
#define pq priority_queue
template <class T>
using V = vector<T>;
using ll = long long;
using vi = V<int>;
using vl = V<ll>;
using pi = pair<int, int>;
using ti = tuple<int, int, int>;
using Adj = V<vi>;
using vvi = V<vi>;
#include "split.h"
using namespace std;
Adj G;
V<bool> vis;
vi res;
void dfs(int u, int &cnt, int b) {
if (cnt > b) return;
res[u] = 2;
vis[u] = 1;
if (++cnt == b) return;
forl(c, G[u]) if (!vis[c]) {
dfs(c, cnt, b);
}
}
vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) {
G.assign(n, {});
vis.assign(n, 0);
res.assign(n, 0);
int m = p.size();
f0r(i, m) {
G[p[i]].pb(q[i]);
G[q[i]].pb(p[i]);
}
if (a == 1) {
int cnt = 0;
dfs(0, cnt, b);
bool f = 0;
f0r(i, n) if (!vis[i]) {
if (!f) {
f=1;
res[i] = 1;
} else res[i] = 3;
}
return res;
}
return res;
}