#include <iostream>
#include <queue>
#include <map>
#include <list>
#include <vector>
#include <string>
#include <stack>
#include <limits>
#include <climits>
#include <cassert>
#include <fstream>
#include <cstring>
#include <cmath>
#include <bitset>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <cstdio>
#include <ciso646>
#include <set>
#include <array>

using namespace std;

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)

#define inf 0x3f3f3f3f
#define PB push_back
#define MP make_pair
#define ALL(a) (a).begin(),(a).end()
#define SET(a,c) memset(a,c,sizeof a)
#define CLR(a) memset(a,0,sizeof a)
#define pii pair<int,int>
#define pcc pair<char,char>
#define pic pair<int,char>
#define pci pair<char,int>
#define VS vector<string>
#define VI vector<int>
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define MIN(a,b) (a>b?b:a)
#define MAX(a,b) (a>b?a:b)
#define pi 2*acos(0.0)
#define INFILE() freopen("in0.txt","r",stdin)
#define OUTFILE()freopen("out0.txt","w",stdout)
#define ll long long
#define ull unsigned long long
#define eps 1e-14
#define FST first
#define SEC second
#define SETUP cin.tie(0), ios::sync_with_stdio(false), cout << setprecision(15)

namespace {
	struct input_returnner {
		int N; input_returnner(int N_ = 0) :N(N_) {}
		template<typename T> operator vector<T>() const { vector<T> res(N); for (auto &a : res) cin >> a; return std::move(res); }
		template<typename T> operator T() const { T res; cin >> res; return res; }
		template<typename T> T operator - (T right) { return T(input_returnner()) - right; }
		template<typename T> T operator + (T right) { return T(input_returnner()) + right; }
		template<typename T> T operator * (T right) { return T(input_returnner()) * right; }
		template<typename T> T operator / (T right) { return T(input_returnner()) / right; }
		template<typename T> T operator << (T right) { return T(input_returnner()) << right; }
		template<typename T> T operator >> (T right) { return T(input_returnner()) >> right; }
	};
	template<typename T> input_returnner in() { return in<T>(); }
	input_returnner in() { return input_returnner(); }
	input_returnner in(int N) { return std::move(input_returnner(N)); }
}

void solve();
/// ---template---

class union_find {
private:
	vector<int> par;
	vector<int> rank;
	vector<int> count;
public:
	union_find(int N) :par(N), rank(N, 0), count(N, 1) {
		for (int i = 0; i < N; ++i) {
			par[i] = i;
		}
	}

	int find(int x) {
		if (par[x] == x) {
			return x;
		}
		else {
			return par[x] = find(par[x]);
		}
	}

	void unite(int x, int y) {
		x = find(x);
		y = find(y);
		if (x == y) return;

		if (rank[x] < rank[y]) {
			count[y] += count[x];
			par[x] = y;
		}
		else {
			count[x] += count[y];
			par[y] = x;
			if (rank[x] == rank[y]) rank[x]++;
		}
	}

	bool same(int x, int y) {
		return find(x) == find(y);
	}

	int getCount(int x) {
		return count[find(x)];
	}

	void clean() {
		par = vector<int>(par.size());
	}
};

signed main(void) {
	SETUP;
	solve();
	return 0;
}

vector<int> G[300000];
union_find uf(300000);
int cnt[300000] = {};
int re[300000] = {};
bool check[300000] = {};
int res[300000] = {};
vector<int> q(300000);

void DFS(int s){
	if (check[s]) return;
	q.push_back(s);
	int f = uf.find(s);
	cnt[f]++;
	re[s] = f;
	check[s] = true;
	for (int to : G[s]) {
		if(not check[to]) DFS(to);
	}
}

void solve() {
	int N, K, L; cin >> N >> K >> L;
	REP(i, K) {
		uf.unite(in()-1, in()-1);
	}
	REP(i, L) {
		int r = in() - 1;
		int s = in() - 1;
		G[r].push_back(s);
		G[s].push_back(r);
	}

	REP(i, N) {
		q.clear();
		DFS(i);
		for (int a : q) {
			res[a] = cnt[re[a]];
		}
		for (int a : q) {
			cnt[re[a]] = 0;
			re[a] = -1;
		}
	}
	REP(i, N) {
		cout << res[i] << (i == N - 1 ? "\n" : " ");
	}
}

Measured memory_bytes: 17920