Problem: There are n military men in the Berland army. Some of them have given orders to other military men by now. Given m pairs (xi, yi), meaning that the military man xi gave the i-th order to another military man yi.

It is time for reform! The Berland Ministry of Defence plans to introduce ranks in the Berland army. Each military man should be assigned a rank — integer number between 1 and k, inclusive. Some of them have been already assigned a rank, but the rest of them should get a rank soon.

Help the ministry to assign ranks to the rest of the army so that:

  * for each of m orders it is true that the rank of a person giving the order (military man xi) is strictly greater than the rank of a person receiving the order (military man yi); 
  * for each rank from 1 to k there is at least one military man with this rank. 

Input

The first line contains three integers n, m and k (1 ≤ n ≤ 2·105, 0 ≤ m ≤ 2·105, 1 ≤ k ≤ 2·105) — number of military men in the Berland army, number of orders and number of ranks.

The second line contains n integers r1, r2, ..., rn, where ri > 0 (in this case 1 ≤ ri ≤ k) means that the i-th military man has been already assigned the rank ri; ri = 0 means the i-th military man doesn't have a rank yet.

The following m lines contain orders one per line. Each order is described with a line containing two integers xi, yi (1 ≤ xi, yi ≤ n, xi ≠ yi). This line means that the i-th order was given by the military man xi to the military man yi. For each pair (x, y) of military men there could be several orders from x to y.

Output

Print n integers, where the i-th number is the rank of the i-th military man. If there are many solutions, print any of them.

If there is no solution, print the only number -1.

Examples

Input

5 3 3
0 3 0 0 2
2 4
3 4
3 5


Output

1 3 3 2 2 


Input

7 6 5
0 4 5 4 1 0 0
6 1
3 6
3 1
7 5
7 1
7 4


Output

2 4 5 4 1 3 5 


Input

2 2 2
2 1
1 2
2 1


Output

-1

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
#pragma GCC diagnostic ignored "-Wunused-result"
#pragma GCC diagnostic ignored "-Wunused-function"
using namespace std;
namespace {
namespace shik {
template <class T>
void _R(T &x) {
  cin >> x;
}
void _R(int &x) { scanf("%d", &x); }
void _R(int64_t &x) { scanf("%" SCNd64, &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template <class T, class... U>
void R(T &head, U &...tail) {
  _R(head);
  R(tail...);
}
template <class T>
void _W(const T &x) {
  cout << x;
}
void _W(const int &x) { printf("%d", x); }
void _W(const int64_t &x) { printf("%" PRId64, x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template <class T>
void _W(const vector<T> &x) {
  for (auto i = x.begin(); i != x.end(); _W(*i++))
    if (i != x.cbegin()) putchar(' ');
}
void W() {}
template <class T, class... U>
void W(const T &head, const U &...tail) {
  _W(head);
  putchar(sizeof...(tail) ? ' ' : '\n');
  W(tail...);
}
template <class T, class F = less<T>>
void sort_uniq(vector<T> &v, F f = F()) {
  sort(begin(v), end(v), f);
  v.resize(unique(begin(v), end(v)) - begin(v));
}
template <class T>
inline T bit(T x, int i) {
  return (x >> i) & 1;
}
template <class T>
inline bool chkmax(T &a, const T &b) {
  return b > a ? a = b, true : false;
}
template <class T>
inline bool chkmin(T &a, const T &b) {
  return b < a ? a = b, true : false;
}
template <class T>
using MaxHeap = priority_queue<T>;
template <class T>
using MinHeap = priority_queue<T, vector<T>, greater<T>>;
const int N = 4e5 + 10;
int n, m, k, r[N], deg[N], dp[N], dq[N], sol[N];
vector<int> e[N], re[N];
bool cmp(int a, int b) { return tie(dp[a], dq[a]) < tie(dp[b], dq[b]); }
bool solve() {
  for (int i = (1); i <= int(k - 1); i++) e[n + i + 1].push_back(n + i);
  for (int i = (1); i <= int(n); i++)
    if (r[i]) {
      if (r[i] > 1) e[i].push_back(n + r[i] - 1);
      if (r[i] < k) e[n + r[i] + 1].push_back(i);
    }
  for (int i = (1); i <= int(n + k); i++)
    for (int j : e[i]) re[j].push_back(i);
  for (int i = (1); i <= int(n + k); i++) deg[i] = ((int)(e[i]).size());
  vector<int> tp;
  for (int i = (1); i <= int(n + k); i++)
    if (!deg[i]) tp.push_back(i);
  for (int i = 0; i < int(((int)(tp).size())); i++) {
    int p = tp[i];
    for (int j : re[p])
      if (--deg[j] == 0) tp.push_back(j);
  }
  if (((int)(tp).size()) != n + k) return 0;
  for (int i : tp) {
    int mx = 0;
    for (int j : e[i]) chkmax(mx, dp[j]);
    dp[i] = mx + 1;
  }
  if (*max_element(dp + 1, dp + n + 1) > k) return 0;
  auto rtp = tp;
  reverse(begin(rtp), end(rtp));
  for (int i : rtp) {
    int mi = k + 1;
    for (int j : re[i]) chkmin(mi, dq[j]);
    dq[i] = mi - 1;
  }
  for (int i = (1); i <= int(n); i++)
    if (r[i]) {
      if (r[i] != dp[i] || r[i] != dq[i]) return 0;
    }
  auto ord = rtp;
  sort(begin(ord), end(ord), cmp);
  MinHeap<pair<int, int>> h;
  for (int i = 1, jj = 0; i <= k; i++) {
    while (jj < n + k && dp[ord[jj]] <= i) {
      h.push({dq[ord[jj]], jj});
      jj++;
    }
    bool ok = 0;
    while (!h.empty() && h.top().first == i) {
      int j = ord[h.top().second];
      h.pop();
      sol[j] = i;
      if (j <= n) ok = 1;
    }
    if (!ok) {
      if (h.empty()) return 0;
      int j = ord[h.top().second];
      h.pop();
      sol[j] = i;
    }
  }
  for (int i = (1); i <= int(n); i++)
    for (int j : e[i]) assert(sol[i] > sol[j]);
  W(vector<int>(sol + 1, sol + n + 1));
  return 1;
}
void main() {
  R(n, m, k);
  for (int i = (1); i <= int(n); i++) R(r[i]);
  for (int i = 0; i < int(m); i++) {
    int a, b;
    R(a, b);
    e[a].push_back(b);
    if (r[a] && r[b] && r[a] <= r[b]) {
      W(-1);
      return;
    }
  }
  if (!solve()) {
    W(-1);
  }
}
}  // namespace shik
}  // namespace
int main() {
  shik::main();
  return 0;
}