#include<bits/stdc++.h>
template <typename _Tp>void read(_Tp &x){
	char ch(getchar());bool f(false);while(!isdigit(ch))f|=ch==45,ch=getchar();
	x=ch&15,ch=getchar();while(isdigit(ch))x=x*10+(ch&15),ch=getchar();
	if(f)x=-x;
}
template <typename _Tp,typename... Args>void read(_Tp &t,Args &...args){read(t);read(args...);}
const int N=105,mod=1000000007,inv2=(mod+1)/2;
typedef long long ll;
template<typename _Tp1,typename _Tp2>inline void add(_Tp1 &a,_Tp2 b){(a+=b)>=mod&&(a-=mod);}
template<typename _Tp1,typename _Tp2>inline void sub(_Tp1 &a,_Tp2 b){(a-=b)<0&&(a+=mod);}
ll ksm(ll a,ll b=mod-2){ll res=1;while(b){if(b&1)res=res*a%mod;a=a*a%mod,b>>=1;}return res;}
int a[N],b[N];
int X[N*N],Y[N*N],n;
struct mat{
	int a[N][N];
	mat operator * (const mat &o)const{
		mat c;memset(c.a,0,sizeof(c.a));
		for(int i=0;i<n;++i)for(int k=0;k<n;++k)for(int j=0;j<n;++j)add(c.a[i][j],1ULL*a[i][k]*o.a[k][j]%mod);
		return c;
	}
}I,M,orig;
mat ksm(mat a,int b){
	mat res=I;
	while(b){
		if(b&1)res=res*a;
		a=a*a,b>>=1;
	}
	return res;
}
int main(){
	int m,k;read(n,m,k);
	for(int i=0;i<n;++i)I.a[i][i]=1;
	for(int i=0;i<n;++i)read(orig.a[i][0]);
	for(int i=1;i<=m;++i)read(X[i],Y[i]);
	ll inv=ksm(m);
	for(int i=0;i<n;++i)M.a[i][i]=1;
	for(int i=1;i<=m;++i){
		int x=X[i]-1,y=Y[i]-1;
		add(M.a[x][x],1LL*inv*(mod-inv2)%mod),add(M.a[x][y],1LL*inv*inv2%mod);
		add(M.a[y][y],1LL*inv*(mod-inv2)%mod),add(M.a[y][x],1LL*inv*inv2%mod);
	}
	mat o=ksm(M,k)*orig;
	for(int i=0;i<n;++i)printf("%d\n",o.a[i][0]);
	return 0;
}
//全力以赴
#include <bits/stdc++.h> 
using namespace std;
#define ll long long
#define ld long double
#define PI 3.141592653L
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const ll INF = (ll)1e18;
const int N = 2e5 + 5;
const ll MOD = 1e9+7;
 
int parent[N];
const int dx[4] = {+1, 0, -1, 0};
const int dy[4] = {0, -1, 0, +1};
 
ll gcd(ll a, ll b) { 
    if (a == 0) 
        return b;  
    return gcd(b % a, a);  
}
 
ll extGcd(ll a, ll b, ll &x, ll &y) { // solves for x and y where ax+by=gcd(a,b)
    if(b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    ll d = extGcd(b, a % b, y, x);
    y -= a / b * x;
    return d;
}
 
ll modInv(ll a, ll p) { // solve for x=a^-1 where ax + py = 1 % p
    if(gcd(a, p) != 1) return -1; // modInv only exists if a and p are coprime (gcd(a, p) = 1)
    ll x, y;
    extGcd(a, p, x, y);
    x = (x % p + p) % p;
    return x;
}
   
ll lcm(ll a, ll b) {  
    return (a * b) / gcd(a,b);  
} 
 
/*
a^b: 
if b is even -> a^b = a^(b/2) * a^(b/2)
if b is odd -> a^b  = a * a^(b-1/2) * a^(b-1/2)
*/
ll modPow(ll a, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = (res * a) % mod;
        a = (a * a) % mod;
        n >>= 1;
    }
    return res;
}
 
int find(int x) {
    return x == parent[x] ? x : parent[x] = find(parent[x]);
}
 
void Union(int x, int y) {
    int xPar = find(x), yPar = find(y);
    if(xPar != yPar) parent[xPar] = yPar;
}
 
ll nCr(ll n, ll r) {
    ll res = 1;
    for(ll i=1;i<=r;i++) {
        res = res * (n - r + i) / i;
    }
    return res;
}
 
int ask(int i, int j) {
    cout << "? " << i + 1 << ' ' << j + 1 << endl;
    int v;
    cin >> v;
    return v;
}
 
int msbPos(int n) {
    if(n == 0) return 0;
    int msbPos = 0;
    n /= 2;
    while(n != 0) {
        n /= 2;
        msbPos++;
    }
    return msbPos;
}

void solve() {
    int n, m;
    cin >> n >> m;
    vector<int> a(n), b(m), c;
    for(int i=0;i<n;i++) cin >> a[i];
    for(int i=0;i<m;i++) cin >> b[i];
    set_symmetric_difference(a.begin(), a.end(), b.begin(), b.end(), back_inserter(c));
    for(auto x : c) cout << x << ' ';
    cout << endl;
}   

int main()  
{
    IOS
    //int t;
    //cin >> t;
    //while(t--) solve();
    solve();
    return 0; 
}