#include "bits/stdc++.h"
// Nagpur ki public bole to taklif
using namespace std;
#define int long long
#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define all(x) (x).begin(), (x).end()
#define uniq(v) (v).erase(unique(all(v)), (v).end())
#define sz(x) (int)((x).size())
#define fr first
#define sc second
#define pii pair<int, int>
#define rep(i, a, b) for (int i = a; i < b; i++)
#define mem1(a) memset(a, -1, sizeof(a))
#define mem0(a) memset(a, 0, sizeof(a))
#define ppc __builtin_popcount
#define ppcll __builtin_popcountll
#define fast ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);

template <typename T1, typename T2>
istream &operator>>(istream &in, pair<T1, T2> &a)
{
	in >> a.fr >> a.sc;
	return in;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &out, pair<T1, T2> a)
{
	out << a.fr << " " << a.sc;
	return out;
}
template <typename T, typename T1>
T amax(T &a, T1 b)
{
	if (b > a)
		a = b;
	return a;
}
template <typename T, typename T1>
T amin(T &a, T1 b)
{
	if (b < a)
		a = b;
	return a;
}

template <typename T_vector>
void output_vector(const T_vector &v, bool addOne = false, int start = -1, int end = -1)
{
	if (start < 0)
		start = 0;
	if (end < 0)
		end = (int)v.size();
	for (int i = start; i < end; i++)
		cout << v[i] + (addOne ? 1 : 0) << (i < end - 1 ? ' ' : '\n');
}

int ceil(int x, int y)
{
	return x / y + (x % y > 0);
}

const long long INF = 1e18;
const int32_t M = 1e9 + 7;
const int32_t MM = 998244353;

const int N = 3e5 + 10;

int bit[N];

void update(int i, int x)
{
	i++;
	while (i <= N)
	{
		bit[i] += x;
		i += i & -i;
	}
}

int sum(int i)
{
	i++;
	int ans = 0;
	while (i > 0)
	{
		ans += bit[i];
		i -= i & -i;
	}
	return ans;
}

void solve()
{
	int n;
	cin >> n;
	int v[n + 1];
	for (int i = 1; i <= n; ++i)
	{
		cin >> v[i];
	}

	int inversionCount = 0;
	unordered_map<int, int> m;
	for (int i = 1; i <= n; ++i)
	{
		int tmp = 1LL * (i - 1LL) - sum(v[i]);
		inversionCount += tmp;
		update(v[i], 1);
	}
	for (int i = 1; i <= n; ++i)
	{
		cout << inversionCount << "\n";
		// cout << v[i] << " ->   " << (n - 1LL) << " - " << (2LL * v[i]) << "\n";
		inversionCount += (n - 1LL) - (2LL * v[i]);
	}
}

signed main()
{
	fast
#ifndef ONLINE_JUDGE

		// For getting input from input.txt file
		freopen("input.txt", "r", stdin);

	// Printing the Output to output.txt file
	freopen("output.txt", "w", stdout);

#endif
	cout << setprecision(12);
	cout << fixed;

	int t = 1;
	// cin>>t;
	while (t--)
		solve();

	return 0;
}

#include <cstdio>
#include <cstring>
#include <algorithm> 
#define rep(a,b,c) for(int a=b;a<=c;a++)
#define per(a,b,c) for(int a=b;a>=c;a--)
const int N=105;
const int p=1e9+7;
#define int long long
template<class T>inline void read(T &x) {
	T f=1;x=0;char s=getchar();
	while(s<'0'||s>'9'){if(s=='-')f=-1;s=getchar();}
	while(s>='0'&&s<='9'){x=x*10+s-'0';s=getchar();}
	x*=f;
}
int n,m,k,a[N*N],b[N*N],f[N],iv,ml,inv2=((p+1)>>1),du[N];
struct matrix {
	int a[N][N];
	matrix() { memset(a,0,sizeof(a)); }
	inline void init() { rep(i,1,n) a[i][i]=1; }
}Ans,mul;
inline matrix operator *(matrix a,matrix b) {
	matrix c;
	rep(i,1,n) rep(j,1,n) rep(k,1,n) (c.a[i][j]+=(a.a[i][k]*b.a[k][j]%p))%=p;
	return c;
}
inline matrix ksm(matrix a,int b) { matrix c; c.init(); for(;b;b>>=1,a=a*a) if(b&1) c=c*a; return c; }
inline int ksm(int a,int b) { int ans=1; for(;b;b>>=1,(a*=a)%=p) if(b&1) (ans*=a)%=p; return ans; }
signed main() {
    read(n); read(m); read(k); iv=ksm(m,p-2);
    rep(i,1,n) read(f[i]);
    rep(i,1,m) read(a[i]),read(b[i]),du[a[i]]++,du[b[i]]++;
    rep(i,1,n) Ans.a[1][i]=f[i];
    rep(i,1,n) mul.a[i][i]=(iv*(m-du[i]))%p;
    rep(i,1,m) {
    	(mul.a[a[i]][a[i]]+=(iv*inv2%p))%=p;
    	(mul.a[b[i]][b[i]]+=(iv*inv2%p))%=p;
    	(mul.a[a[i]][b[i]]+=(iv*inv2%p))%=p;
    	(mul.a[b[i]][a[i]]+=(iv*inv2%p))%=p;
	}
	mul=ksm(mul,k); Ans=Ans*mul;
	rep(i,1,n) printf("%lld\n",Ans.a[1][i]);
}