#include <bits/stdc++.h>
#include "split.h"
using namespace std;
vector<vector<int>> g;
vector<int> sz, parent, ans;
vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) {
g.resize(n);
for (int i = 0; i < n - 1; i++) {
g[p[i]].push_back(q[i]);
g[q[i]].push_back(p[i]);
}
vector<array<int, 2>> v = {{a, 1}, {b, 2}, {c, 3}};
sort(v.begin(), v.end());
vector<int> ans(n);
queue<int> qq;
vector<bool> vis(n);
qq.push(0);
vis[0] = true;
int t = v[1][0];
while (!qq.empty()) {
int u = qq.front();
qq.pop();
if (t == 0) {
break;
}
ans[u] = v[1][1];
t--;
for (int v : g[u]) {
if (!vis[v]) {
vis[v] = true;
qq.push(v);
}
}
}
for (int i = 0; i < n; i++) {
if (ans[i] == 0) {
ans[i] = v[2][1];
}
}
for (int i = 0; i < n; i++) {
if (ans[i] == v[2][1]) {
ans[i] = v[0][1];
break;
}
}
return ans;
}