#include using namespace std; // #define int long long #define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i) #define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i) #define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--) #define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--) #define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i) #define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i) #define SORT(v, n) sort(v, v + n); #define REVERSE(v, n) reverse(v, v+n); #define vsort(v) sort(v.begin(), v.end()); #define all(v) v.begin(), v.end() #define mp(n, m) make_pair(n, m); #define cout(d) cout<; using vvi = vector; using vll = vector; using vvll = vector; using pii = pair; using pll = pair; using vs = vector; using vpll = vector>; using vtp = vector>; using vb = vector; template inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } const ll INF = 1e9; const ll MOD = 1e9+7; const ll LINF = 1e18; class UnionFind{ private: vector Parent; public: UnionFind(ll N){ Parent = vector(N, -1); } ll root(ll A){ if(Parent[A] < 0) return A; return Parent[A] = root(Parent[A]); } ll size(ll A){ return -Parent[root(A)]; } bool connect(ll A, ll B){ A = root(A); B = root(B); if(A == B){ return false; } if(size(A) < size(B)) swap(A, B); Parent[A] += Parent[B]; Parent[B] = A; return true; } bool isSame(ll A, ll B){ return root(A) == root(B); } }; ll n,m,q; vll G[100100]; bool visited[100100]; ll res[100100]; void dfs(ll v, ll p, ll c){ res[v]=c; visited[v]=true; for(auto nv: G[v]){ if(nv==p) continue; if(visited[nv]) continue; dfs(nv,v,c); } } signed main() { cin.tie( 0 ); ios::sync_with_stdio( false ); cin>>n>>m>>q; vpll ab(m); rep(i,m){ ll a,b; cin>>a>>b; a--,b--; ab[i]={a,b}; } vpll cd(q); set s; rep(i,q){ ll c,d; cin>>c>>d; c--,d--; cd[i]={c,d}; s.insert({c,d}); } UnionFind uf(n); rep(i,m){ if(!s.count(ab[i])){ ll a,b; tie(a,b)=ab[i]; G[a].push_back(b); G[b].push_back(a); uf.connect(a,b); } } rep(i,n){ if(uf.isSame(0,i)){ visited[i]=true; res[i]=-1; } } rep(i,n){ if(i) cout<<' '; cout<