#include "split.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) {
vector<vector<int>> adj(n);
for (int i = 0; i < (int)p.size(); i++) {
adj[p[i]].push_back(q[i]);
adj[q[i]].push_back(p[i]);
}
int paint = b < c ? 2 : 3;
int need = min(b, c);
vector<int> ans(n, b < c ? 3 : 2);
int na = 0;
for (int i = 0; i < n; i++) if ((int)adj[i].size() == 1) na = i;
ans[na] = 1;
vector<int> seen(n);
auto dfs = [&](auto dfs, int u) -> void {
if (seen[u]) return;
if (!need) return;
seen[u] = 1;
need--;
ans[u] = paint;
for (int v : adj[u]) dfs(dfs, v);
};
dfs(dfs, na ? 0 : 1);
return ans;
}