import java.io.*;
import java.util.*;

public class parties_pk {
	public static void main(String[] args) {
		new parties_pk().run();
	}

	BufferedReader br;
	StringTokenizer in;
	PrintWriter out;

	public String nextToken() throws IOException {
		while (in == null || !in.hasMoreTokens()) {
			in = new StringTokenizer(br.readLine());
		}
		return in.nextToken();
	}

	public int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	public long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	public double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}

	class Edge implements Comparable<Edge> {
		Vertex start, finish;
		long cost;
		Edge brother;

		Edge(Vertex a, Vertex b, long c) {
			start = a;
			finish = b;
			cost = c;
		}

		public int compareTo(Edge e) {
			if (cost != e.cost)
				return (int) cost - (int) e.cost;
			return finish.num - e.finish.num;
		}

		public void revert() {
			brother.start.revert(brother);
		}
	}

	class Vertex implements Comparable<Vertex> {
		int type;
		int num, fAns, sAns;
		TreeSet<Edge> good, bad;

		long minimalBoth;

		Vertex(int z) {
			good = new TreeSet<Edge>();
			bad = new TreeSet<Edge>();
			minimalBoth = Integer.MAX_VALUE;
			num = z;
			type = 0;
		}

		public void revolution() {
			TreeSet<Edge> tmp = new TreeSet<Edge>();
			while (!good.isEmpty()) {
				Edge t = good.first();
				good.remove(t);
				t.revert();
				tmp.add(t);
			}
			while (!bad.isEmpty()) {
				Edge t = bad.first();
				bad.remove(t);
				t.revert();
				good.add(t);
			}
			bad.addAll(tmp);
			type = 1 - type;
			refresh();
		}

		void revert(Edge e) {
			if (bad.contains(e)) {
				good.add(e);
				bad.remove(e);
			} else {
				bad.add(e);
				good.remove(e);
			}
			refresh();
		}

		void refresh() {
			if (!bad.isEmpty()) {
				minimalBoth = bad.first().cost;
				Edge tmp = bad.first();
				bad.remove(bad.first());
				if (!bad.isEmpty()) {
					minimalBoth += bad.first().cost;
					fAns = tmp.finish.num;
					sAns = bad.first().finish.num;
				} else
					minimalBoth = Integer.MAX_VALUE;
				bad.add(tmp);
			}
			if (!good.isEmpty() && (good.first().cost < minimalBoth)) {
				minimalBoth = good.first().cost;
				fAns = this.num;
				sAns = good.first().finish.num;
			}
			res.remove(this);
			res.add(this);
		}

		public int compareTo(Vertex v) {
			if (minimalBoth < v.minimalBoth)
				return -1;
			if (minimalBoth > v.minimalBoth)
				return 1;
			return 0;
		}
	}

	PriorityQueue<Vertex> res;

	public void solve() throws IOException {
		int n = nextInt();
		int m = nextInt();
		int k = nextInt();
		String orient = nextToken();
		Vertex[] v = new Vertex[n];
		for (int i = 0; i < n; i++) {
			v[i] = new Vertex(i + 1);
		}

		for (int i = 0; i < m; i++) {
			int a = nextInt() - 1;
			int b = nextInt() - 1;
			int c = nextInt();
			Edge s = new Edge(v[a], v[b], c);
			Edge f = new Edge(v[b], v[a], c);
			f.brother = s;
			s.brother = f;
			v[a].good.add(s);
			v[b].good.add(f);
		}

		res = new PriorityQueue<Vertex>();
		for (int i = 0; i < n; i++) {
			v[i].refresh();
			if (orient.charAt(i) == 'R')
				v[i].revolution();
			res.add(v[i]);
		}

		out.println(res.peek().minimalBoth + " " + res.peek().fAns + " "
				+ res.peek().sAns);
		for (int i = 0; i < k; i++) {
			int t = nextInt() - 1;
			v[t].revolution();
			out.println(res.peek().minimalBoth + " " + res.peek().fAns + " "
					+ res.peek().sAns);
		}
	}

	public void run() {
		try {
			br = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
			br = new BufferedReader(new FileReader("parties.in"));
			out = new PrintWriter("parties.out");

			solve();

			out.close();
		} catch (IOException e) {
			e.printStackTrace();
			System.exit(1);
		}
	}
}