Problem: Dima took up the biology of bacteria, as a result of his experiments, he invented k types of bacteria. Overall, there are n bacteria at his laboratory right now, and the number of bacteria of type i equals ci. For convenience, we will assume that all the bacteria are numbered from 1 to n. The bacteria of type ci are numbered from <image> to <image>.

With the help of special equipment Dima can move energy from some bacteria into some other one. Of course, the use of such equipment is not free. Dima knows m ways to move energy from some bacteria to another one. The way with number i can be described with integers ui, vi and xi mean that this way allows moving energy from bacteria with number ui to bacteria with number vi or vice versa for xi dollars.

Dima's Chef (Inna) calls the type-distribution correct if there is a way (may be non-direct) to move energy from any bacteria of the particular type to any other bacteria of the same type (between any two bacteria of the same type) for zero cost.

As for correct type-distribution the cost of moving the energy depends only on the types of bacteria help Inna to determine is the type-distribution correct? If it is, print the matrix d with size k × k. Cell d[i][j] of this matrix must be equal to the minimal possible cost of energy-moving from bacteria with type i to bacteria with type j.

Input

The first line contains three integers n, m, k (1 ≤ n ≤ 105; 0 ≤ m ≤ 105; 1 ≤ k ≤ 500). The next line contains k integers c1, c2, ..., ck (1 ≤ ci ≤ n). Each of the next m lines contains three integers ui, vi, xi (1 ≤ ui, vi ≤ 105; 0 ≤ xi ≤ 104). It is guaranteed that <image>.

Output

If Dima's type-distribution is correct, print string «Yes», and then k lines: in the i-th line print integers d[i][1], d[i][2], ..., d[i][k] (d[i][i] = 0). If there is no way to move energy from bacteria i to bacteria j appropriate d[i][j] must equal to -1. If the type-distribution isn't correct print «No».

Examples

Input

4 4 2
1 3
2 3 0
3 4 0
2 4 1
2 1 2


Output

Yes
0 2
2 0


Input

3 1 2
2 1
1 2 0


Output

Yes
0 -1
-1 0


Input

3 2 2
2 1
1 2 0
2 3 1


Output

Yes
0 1
1 0


Input

3 0 2
1 2


Output

No

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
long long dist[100001];
bool done[100001];
long long sub[100001];
void dijkstra(long long source, vector<pair<long long, long long> > ed[],
              long long v, long long tree) {
  priority_queue<pair<long long, long long>,
                 vector<pair<long long, long long> >,
                 greater<pair<long long, long long> > >
      pq;
  for (long long i = 0, _n = (v); i < _n; i++) {
    dist[i + 1] = 1000000000000000;
    done[i + 1] = false;
  }
  dist[source] = {0};
  pq.push(make_pair(0, source));
  while (!pq.empty()) {
    long long minKey = pq.top().second;
    pq.pop();
    sub[minKey] = tree;
    for (long long j = 0, _n = (ed[minKey].size()); j < _n; j++) {
      long long a = minKey;
      long long b = ed[a][j].first;
      long long w = ed[a][j].second;
      if (!done[b] && dist[a] + w < dist[b]) {
        dist[b] = dist[a] + w;
        pq.push(make_pair(dist[b], b));
      }
    }
    done[minKey] = true;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, m, k;
  cin >> n >> m >> k;
  long long c[n];
  long long f[n + 1];
  long long p1 = 1;
  long long re[k + 1];
  re[1] = 1;
  for (long long i = 0, _n = (k); i < _n; i++) {
    cin >> c[i];
    for (long long j = 0, _n = (c[i]); j < _n; j++) {
      f[p1] = i + 1;
      p1++;
    }
  }
  for (long long i = (2), _b = (k); i <= _b; i++) {
    re[i] = re[i - 1] + c[i - 2];
  }
  vector<pair<long long, long long> > ed[n + 1];
  for (long long i = 0, _n = (m); i < _n; i++) {
    long long u, v, w;
    cin >> u >> v >> w;
    ed[u].push_back(make_pair(v, w));
    ed[v].push_back(make_pair(u, w));
  }
  for (long long i = (1), _b = (k); i <= _b; i++) {
    if (!done[re[i]]) dijkstra(re[i], ed, n, k);
  }
  long long hu = true;
  p1 = 1;
  for (long long i = 0, _n = (k); i < _n; i++) {
    long long x = dist[p1];
    long long y = sub[p1];
    for (long long j = 0, _n = (c[i]); j < _n; j++) {
      if (dist[p1] != x || sub[p1] != y) {
        hu = false;
      }
      p1++;
    }
  }
  if (!hu) {
    cout << "No" << endl;
    return 0;
  }
  cout << "Yes" << endl;
  long long mat[k + 1][k + 1];
  for (long long i = 0, _n = (k + 1); i < _n; i++) {
    for (long long j = 0, _n = (k + 1); j < _n; j++) {
      mat[i][j] = 1000000000000000;
    }
  }
  for (long long i = 0, _n = (k + 1); i < _n; i++) {
    mat[i][i] = 0;
  }
  for (long long i = (1), _b = (n); i <= _b; i++) {
    for (long long j = 0, _n = (ed[i].size()); j < _n; j++) {
      long long x = i;
      long long y = ed[i][j].first;
      long long w = ed[i][j].second;
      if (mat[f[x]][f[y]] > w) mat[f[x]][f[y]] = w;
    }
  }
  long long dp[k + 1][k + 1];
  for (long long i = 0, _n = (k); i < _n; i++) {
    for (long long j = 0, _n = (k); j < _n; j++) {
      dp[i + 1][j + 1] = mat[i + 1][j + 1];
    }
  }
  for (long long l = 0, _n = (k); l < _n; l++) {
    for (long long i = 0, _n = (k); i < _n; i++) {
      for (long long j = 0, _n = (k); j < _n; j++) {
        dp[i + 1][j + 1] =
            min(dp[i + 1][j + 1], dp[i + 1][l + 1] + dp[l + 1][j + 1]);
      }
    }
  }
  for (long long i = 0, _n = (k); i < _n; i++) {
    for (long long j = 0, _n = (k); j < _n; j++) {
      if (dp[i + 1][j + 1] >= 10000000000)
        cout << "-1 ";
      else
        cout << dp[i + 1][j + 1] << " ";
    }
    cout << endl;
  }
}