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 JAVA):

Solution:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.Queue;
import java.util.HashSet;

public class Main
{
	public static void main(String[] args) {
		new Thread(null, new Runnable() {
			public void run() {
                solve();
            }
        }, "1", 1 << 26).start();
	}
	static void solve () {
		FastReader fr =new FastReader();	PrintWriter op =new PrintWriter(System.out);
 		
 		ArrayList<ArrayList<Integer>> g =new ArrayList<>() ,w =new ArrayList<>() ;
 		int n =fr.nextInt() ,m =fr.nextInt() ,t =fr.nextInt() ,c[] =new int[t+1] ,p[] =new int[n] ;
 		HashSet<Integer> tch =new HashSet<>() ;	int i ,j =1 ,k ;

 		for (i =1 ; i<=t ; ++i)	c[i] =fr.nextInt()+c[i-1] ;
 		for (i =0 ; i<n ; ++i) {
 			if (i<c[j])	p[i] =j-1 ;	else 	p[i] =j++ ;
 			g.add(new ArrayList<>()) ;	w.add(new ArrayList<>()) ;
 		}
 		while (m-->0) {
 			i =fr.nextInt()-1 ;	j =fr.nextInt()-1 ;	k =fr.nextInt() ;
 			g.get(i).add(j) ;	g.get(j).add(i) ;	w.get(i).add(k) ;	w.get(j).add(k) ;
 		}
 		
 		Queue<Integer> q =new LinkedList<>() ;	boolean mrk[] =new boolean[t] ,nd[] =new boolean[n+1] ,f =false ;
 		for (i =0 ; i<t ; ++i) {
 			if (mrk[i])	continue;	tch.add(i) ;	q.add(c[i]) ;	nd[c[i]] =true ;
 			while (!q.isEmpty()) {
 				m =q.poll() ;
 				for (j =0 ; j<g.get(m).size() ; ++j) {
 					k =g.get(m).get(j) ;	if (nd[k])	continue;
 					if (w.get(m).get(j) != 0)	continue;
 					tch.add(p[k]) ;	q.add(k) ;	nd[k] =true ;
 				}
 			}
 			for (int id : tch) {
 				for (j =c[id] ; j<c[id+1] ; ++j) {
 					if (!nd[j])	break;
 				}
 				if (j==c[id+1])	mrk[id] =true ;
 				else 	{	f =true ;	break; 	}
 			}
 			if (f)	break;
 			tch.clear() ;
 		}
 		if (i==t) {
 			op.println("Yes") ;
 			int mat[][] =new int[t][t] ;
 			for (i =0 ; i<t ; ++i) {
 				for (j =0 ; j<t ; ++j)	mat[i][j] =-1 ;	mat[i][i] =0 ;
 			}
 			for (i =0 ; i<n ; ++i) {
 				for (j =0 ; j<g.get(i).size() ; ++j) {
 					k =g.get(i).get(j) ;	if (p[i]==p[k])	continue;	m =mat[p[i]][p[k]] ;
 					if (m==-1)	mat[p[i]][p[k]] =w.get(i).get(j) ;
 					else 	mat[p[i]][p[k]] =Math.min(m , w.get(i).get(j)) ;
 				}
 			}
 			//Floyd-Warshall
 			for (i =0 ; i<t ; ++i) {
 				for (j =0 ; j<t ; ++j) {
 					for (k =0 ; k<t ; ++k) {
 						if (mat[j][i]==-1 || mat[i][k]==-1)	continue;
 						else 	m =mat[j][i] + mat[i][k] ;
 						if (mat[j][k]==-1)	mat[j][k] =m ;
 						else 	mat[j][k] =Math.min(mat[j][k] , m) ; 
 					}
 				}
 			}
 			for (i =0 ; i<t ; ++i) {
 				for (j =0 ; j<t ; ++j)	op.print(mat[i][j]+" ") ;	op.println() ;
 			}
 		}
 		else 	op.println("No") ;
		op.flush();	op.close();
	}
	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br =new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st==null || (!st.hasMoreElements())) 
			{
				try
				{
					st =new StringTokenizer(br.readLine());
				}
				catch(IOException e)
				{
					e.printStackTrace();
				}
				
			}
			return st.nextToken();
		}

		String nextLine() {
			String str ="";

			try
			{
				str =br.readLine();
			}
			catch(IOException e)
			{
				e.printStackTrace();
			}

			return str;
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next()) ;
		}
	}
}