#include #include #include #include #include #define ll long long using namespace std; const int maxn=110, inf=1e9; struct poi{int x, y, w, pos;}q[3][maxn]; int n, m, T, x, y, z; int fa[maxn], cnt[2], ans[maxn]; bool v[maxn]; char s[233]; template inline void read(T &k) { int f=1; k=0; char c=getchar(); while(c<'0' || c>'9') c=='-'&&(f=-1), c=getchar(); while(c<='9' && c>='0') k=k*10+c-'0', c=getchar(); k*=f; } bool operator < (poi a, poi b){return a.w