#include <bits/stdc++.h>
using namespace std;
//#include "testlib.h"
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define int long long
#define ll long long
#define M 1000000007
#define MM 998244353
#define inputarr(a,n) for(int i=0;i<n;++i) cin>>a[i]
#define GCD(m,n) __gcd(m,n)
#define LCM(m,n) m*(n/GCD(m,n))
#define mii  map<ll ,ll >
#define msi  map<string,ll >
#define rep(a,b)    for(ll i=a;i<b;i++)
#define rep0(n)    for(ll i=0;i<n;i++)
#define repi(i,a,b) for(ll i=a;i<b;i++)
#define pb push_back
#define vi vector<ll>
#define vs vector<string>
#define ppb pop_back
#define endl '\n'
#define asdf ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define r0 return 0;
#define FORD(i, a, b) for (int i = (int) (a); i >= (int) (b); --i)
#define inputoutput freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
#define Set(a, s) (a, s, sizeof (a))
#define FOR repi
#define vii vector<pii>
#define pii pair<int,int>
#define REVERSE(v) reverse(all(v))
#define trav(a, x) for(auto& a : x)
#define display(x) trav(a,x) cout<<a<<" ";cout<<endl
#define debug cerr<<"bhau"<<endl
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    std::cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
template<typename T, typename U> static inline void amin(T &x, U y) 
{ 
    if (y < x) 
        x = y; 
}
template<typename T, typename U> static inline void amax(T &x, U y) 
{ 
    if (x < y) 
        x = y; 
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

ll max(ll a, ll b) { return (a > b)? a : b;}
int min(int a, int b) { return (a < b)? a : b;} 

const int N = 4e5+10;
vi adj[N];
bool vis[N];
int vert;
bool tree = 1;
void dfs(int v,int p){
    vert++;
    vis[v]=1;
    for(auto i:adj[v]){
        if(i!=p){
            if(vis[i]) 
                tree=0;
            else
                dfs(i,v);
        }
    }
}
int solve(){

    int n;cin>>n;
    int a,b;
    rep0(n){
        cin>>a>>b;
        adj[a].pb(b);
        adj[b].pb(a);
    }
    int ans=0; 
    for(int i=1;i<=N;i++){
        if(!vis[i]){
            tree = 1;
            vert=0;
            dfs(i,-1);

            if(tree){
                ans+=vert-1;
            }
            else ans+=vert;
        }
    }
    cout<<ans<<endl;




    return 0;
}
signed main(){
    asdf
    int t=1;
    // cin>>t;
    while(t--){
        solve();
    }
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template <class c, class cmp = less<c> > using ordered_set = tree<c, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...) 
#endif
template<class T> ostream& operator<<(ostream &os, vector<T> V) {os << "[ "; for(auto v : V) os << v << " "; return os << "]";}
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {return os << "(" << P.first << "," << P.second << ")";}
template <typename T,typename U>pair<T,U> operator+(const pair<T,U> & l,const std::pair<T,U> & r) { return {l.first+r.first,l.second+r.second};}
typedef long long int ll;
const ll MOD = 1e9 + 7;
const ll maxn = 5e6 + 5;
#define endl '\n'
#define ld long double
#define int ll
#define all(x)  (x).begin(),(x).end()



ll sum(ll x, ll y)
{
  x += y;
  if (x >= MOD)
    return x - MOD;
  return x;
}
ll mult(ll x, ll y)
{
  return (x * y) % MOD;
}

inline ll power(ll a, long long b) {
  ll res = 1;
  while (b > 0) {
    if (b & 1) {
      res = mult(res, a);
    }
    a = mult(a, a);
    b >>= 1;
  }
  return res;
}

const ll N=100;
int n;
struct Matrix
{
  ll a[N][N];
 
  Matrix()
  {
    for (int i = 0; i < n; i++)
      for (int j = 0; j < n; j++)
        a[i][j] = 0;
  }
 
  Matrix operator * (const Matrix &X) const
  {
    Matrix res;
    for (int i = 0; i < n; i++)
      for (int j = 0; j < n; j++)
      {
        res.a[i][j] = 0;
        for (int h = 0; h < n; h++)
        {
          res.a[i][j] = sum(res.a[i][j], mult(a[i][h], X.a[h][j]));
        }
      }
    return res;
  }
};
 
Matrix bin_pow(Matrix x, ll pow)
{
  if (pow == 1) return x;
  if (pow == 2) return x * x;
  if (pow & 1) return x * bin_pow(x, pow - 1);
  return bin_pow(bin_pow(x, pow / 2), 2);
}

int32_t main(){
 
  IOS



  int m, k;
  cin >> n >> m >> k;
  int a[n];
  for(int i = 0; i<n;i++){
    cin >> a[i];
    if(k == 0) cout << a[i] << endl;
  }
  if(k == 0) return 0;

  int inv_m = power(2*m, MOD - 2);
  Matrix G;
  int deg[n] = {0};
  for(int i = 0; i < m;i++){
    int u, v;
    cin >> u >> v;
    u--, v--;
    deg[u]++;
    deg[v]++;
    G.a[u][v] = inv_m;
    G.a[v][u] = inv_m;
  }


  for(int i = 0;i < n;i++) G.a[i][i] = mult(2*m - deg[i], inv_m);

  // for(int i = 0; i < n;i++){
  //   for(int j = 0;j<n;j++) cout << G.a[i][j] << " ";
  //   cout << endl;
  // }
  G = bin_pow(G, k);
  for(int i = 0; i < n;i++){
    int ans = 0;
    for(int j = 0; j < n;j++){
      ans = sum(ans, mult(a[j], G.a[j][i]));
    }
    cout << ans << endl;
  }


  


  




    
 
    
}  