output_description: Print N integers. The i-th of them should represent the number of the cities
  connected to the i-th city by both roads and railways.
  
  * * *
input_description: The input is given from Standard Input in the following format:
  
      
      
      N K L
      p_1 q_1
      :
      p_K q_K
      r_1 s_1
      :
      r_L s_L
attempt: #include <bits/stdc++.h>
  using namespace std;
  #define REP(i, n) for(int i = 0;i < n;i++)
  #define REPR(i, n) for(int i = n;i >= 0;i--)
  #define FOR(i, m, n) for(int i = m;i < n;i++)
  #define itrfor(itr,A) for(auto itr = A.begin(); itr !=A.end();itr++)
  typedef long long llong;
  char moji[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
  char moji2[26]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
  char moji3[10]={'0','1','2','3','4','5','6','7','8','9'};
  #define Sort(a) sort(a.begin(),a.end());
  #define Reverse(a) reverse(a.begin(),a.end());
  #define print(a) cout << a << endl;
  #define n_max int(1e5+5)
  
  
  struct UnionFind{
      int A[n_max];
      UnionFind( int n){
          REP(i,n) A[i]=i;
      }
  
      int root(int a){
          if(A[a] == a)    return a;
          int tmp;
          tmp = root(A[a]);
          A[a] = tmp;
          return tmp;
      }
  
      bool same(int a, int b){
          if(root(a) == root(b)) return true;
          return false;
      }
  
      void merge(int a,int b){
          A[root(a)] = root(b);
      }
  };
  
  
  struct town{
      int k,l;
      int id;
  };
  
  
  bool comp(town a,town b){
      if(a.k != b.k) return a.k < b.k;
      else return a.l < b.l;
  }
  
  
  int main(){
      int n,k,l;
      cin >> n >> k >> l;
      UnionFind K(n),L(n);
  
      int a,b;
      REP(i,k){
          scanf("%d%d",&a,&b);
          K.merge(a-1,b-1);
      }
      REP(i,l){
          scanf("%d%d",&a,&b);
          L.merge(a-1,b-1);
      }
  
      town T[n_max];
      REP(i,n){
          T[i].id=i;
          T[i].k = K.root(i);
          T[i].l = L.root(i);
      }
  
      sort(T,T+n,comp);
  
      int ans[n_max]={};
  
      int i=0;
      while(1){
          pair<int,int> p;
          p.first = T[i].k;
          p.second = T[i].l;
          vector<int> ind;
          ind.push_back(T[i].id);
          while(1){
              i+=1;
              if(i < n and T[i].k == p.first and T[i].l == p.second){
                  ind.push_back(T[i].id);
              }
              else{
                  itrfor(itr,ind) ans[*itr] = ind.size();
                  break;
              }
          }
          if(i >=n) break;
      }
  
      REP(i,n) cout << ans[i] << " ";
  
  }
problem_description: Statement
  
  There are N cities. There are also K roads and L railways, extending between
  the cities. The i-th road bidirectionally connects the p_i-th and q_i-th
  cities, and the i-th railway bidirectionally connects the r_i-th and s_i-th
  cities. No two roads connect the same pair of cities. Similarly, no two
  railways connect the same pair of cities.
  
  We will say city A and B are _connected by roads_ if city B is reachable from
  city A by traversing some number of roads. Here, any city is considered to be
  connected to itself by roads. We will also define _connectivity by railways_
  similarly.
  
  For each city, find the number of the cities connected to that city by both
  roads and railways.
samples: [{"input": "4 3 1\n    1 2\n    2 3\n    3 4\n    2 3", "output": "1 2 2 1\n    \n\nAll the four cities are connected to each other by roads.\n\nBy railways, only the second and third cities are connected. Thus, the answers\nfor the cities are 1, 2, 2 and 1, respectively.\n\n* * *"}, {"input": "4 2 2\n    1 2\n    2 3\n    1 4\n    2 3", "output": "1 2 2 1\n    \n\n* * *"}, {"input": "7 4 4\n    1 2\n    2 3\n    2 5\n    6 7\n    3 5\n    4 5\n    3 4\n    6 7", "output": "1 1 2 1 2 2 2"}]