#include <bits/stdc++.h>
#define fi first
#define se second
#define gc getchar() //(p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<20,stdin),p1==p2)?EOF:*p1++)
#define mk make_pair
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define IT iterator
#define V vector
#define TP template <class o>
#define TPP template <typename t1, typename t2>
#define SZ(a) ((int)a.size())
#define all(a) a.begin(), a.end()
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define REP(i, a, b) for (int i = b; i >= a; i--)
#define FOR(i, n) rep(i, 1, n)
#define debug(x) cerr << #x << ' ' << '=' << ' ' << x << endl
using namespace std;
typedef double db;
typedef unsigned ui;
typedef long long ll;
typedef long double ld;

// char buf[1 << 20],*p1=buf,*p2=buf;
TP void qr(o& x) {
    char c = gc;
    x = 0;
    int f = 1;
    while (!isdigit(c)) {
        if (c == '-')
            f = -1;
        c = gc;
    }
    while (isdigit(c))
        x = x * 10 + c - '0', c = gc;
    x *= f;
}
template <class o, class... O> void qr(o& x, O&... y) { qr(x), qr(y...); }
TP void qw(o x) {
    if (x < 0)
        putchar('-'), x = -x;
    if (x / 10)
        qw(x / 10);
    putchar(x % 10 + '0');
}
TP void pr1(o x) { qw(x), putchar(' '); }
template <class o, class... O> void pr1(o x, O... y) { pr1(x), pr1(y...); }
TP void pr2(o x) { qw(x), putchar(10); }
template <class o, class... O> void pr2(o x, O... y) { pr2(x), pr2(y...); }
TP bool cmax(o& x, o y) { return (x < y ? x = y, 1 : 0); }
TP bool cmin(o& x, o y) { return (x > y ? x = y, 1 : 0); }

const int mod = (int)1e9 + 7;
TPP void ad(t1& x, t2 y) { (x += y) >= mod && (x -= mod); }
TPP void dl(t1& x, t2 y) { (x -= y) < 0 && (x += mod); }

ll gcd(ll a, ll b) { return !a ? b : gcd(b % a, a); }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
ll power(ll a, ll b = mod - 2, ll p = mod) {
    ll c = 1;
    while (b) {
        if (b & 1)
            c = c * a % p;
        b /= 2;
        a = a * a % p;
    }
    return c;
}
ll exgcd(ll a, ll b, ll& x, ll& y) {
    if (!a) {
        x = 0;
        y = 1;
        return b;
    }
    ll d = exgcd(b % a, a, y, x);
    x -= b / a * y;
    return d;
}
ll INV(ll n, ll p = mod) {
    ll x, y;
    exgcd(n, p, x, y);
    return (x % p + p) % p;
}

const int N = 110;
const ll INF = 1e15;
int n, m, k, val[N];

struct rec {
    int a[N][N];
    rec() { memset(a, 0, sizeof a); }
    rec operator*(rec b) const {
        rec c;
        FOR(i, n) FOR(j, n) FOR(k, n) ad(c.a[i][k], 1ll * a[i][j] * b.a[j][k] % mod);
        return c;
    }
} a, c;

void solve() {
    qr(n, m, k);
    FOR(i, n) a.a[i][i] = c.a[i][i] = 1, qr(val[i]);
    ll inv = power(2 * m);
    while (m--) {
        int x, y;
        qr(x, y);
        dl(a.a[x][x], inv);
        ad(a.a[x][y], inv);
        dl(a.a[y][y], inv);
        ad(a.a[y][x], inv);
    }
    while (k) {
        if (k & 1)
            c = c * a;
        k /= 2;
        a = a * a;
    }
    FOR(i, n) {
        ll ans = 0;
        FOR(j, n) ad(ans, 1ll * c.a[j][i] * val[j] % mod);
        pr2(ans);
    }
}

int main() {
#ifndef ONLINE_JUDGE
    clock_t start_time = clock();
#endif
    int T = 1;
    // qr(T);
    while (T--)
        solve();
#ifndef ONLINE_JUDGE
    cerr << 1.0 * (clock() - start_time) / CLOCKS_PER_SEC << ' ' << 's' << endl;
#endif
    return 0;
}

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>

#include <set>
#include <map>
#include <iomanip>

using namespace std;

#define rep(i, n) for(long long i = 0; i < (long long)(n); i++)
#define rrep(i, n) for(long long i = (long long)(n - 1); i >= 0; i--)
#define all(x) (x).begin(),(x).end()

using ll = long long;
using ull = unsigned long long;

int main()
{
	char a, b, c;
	cin >> a >> b >> c;


	cout << b << c << a << endl;

	return 0;
}
