#include #include #include #include #define ll long long #define pb push_back #define pii pair #define maxn 400400 #define mod 1000000007 #define debug(args...) fprintf(stderr,args) using namespace std; int n,d; int x[maxn]; int y[maxn]; int p[maxn]; int find(int x){ return p[x] = (x == p[x]) ? x : find(p[x]); } int main(){ scanf("%*d%*d%d%d",&n,&d); for(int i=0;i