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

//import java.math.*;

public class parties_sp_wa implements Runnable {
	public static void main(String[] args) {
		new Thread(new parties_sp_wa()).start();
	}

	@Override
	public void run() {
		try {
			br = new BufferedReader(new FileReader(FNAME + ".in"));
			out = new PrintWriter(FNAME + ".out");
			solve();
			out.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	BufferedReader br;
	StringTokenizer st;
	PrintWriter out;
	boolean eof = false;

	String nextToken() {
		while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (Exception e) {
				eof = true;
				return "0";
			}
		}
		return st.nextToken();
	}

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

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

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

	private final String FNAME = "parties";

	class Edge {
		public Edge(int a2, int b2, int c2) {
			a = a2;
			b = b2;
			c = c2;
		}

		int a, b, c;
	}

	ArrayList<Edge>[] G;

	class Vertex implements Comparable<Vertex> {
		int num, color, w;

		public Vertex(int b, int c, int i) {
			num = b;
			w = c;
			color = i;
		}

		@Override
		public int compareTo(Vertex o) {
			if (w != o.w)
				return w - o.w;
			return num - o.num;
		}
	}

	class Pair implements Comparable<Pair> {
		int a, b, l, p;

		Pair(int x, int y, int c, int d) {
			a = Math.min(x, y);
			b = Math.max(x, y);
			l = c;
			p = d;
		}

		@Override
		public int compareTo(Pair o) {
			if (l < o.l)
				return -1;
			if (l > o.l)
				return 1;
			if (a != o.a)
				return a - o.a;
			if (b != o.b)
				return b - o.b;
			return p - o.p;
		}
	}
	
	int MAXN = 100000;

	void solve() {
		int n = nextInt();
		assert((1 <= n) && (n <= MAXN));
		int m = nextInt();
		assert((1 <= m) && (m <= MAXN));
		int k = nextInt();
		assert((1 <= k) && (k <= MAXN));
		G = new ArrayList[n];
		TreeMap<Integer, Vertex>[] nei = new TreeMap[n];
		TreeSet<Vertex>[][] best = new TreeSet[n][2];
		for (int i = 0; i < n; i++) {
			G[i] = new ArrayList<Edge>();
			nei[i] = new TreeMap<Integer, Vertex>();
			best[i][0] = new TreeSet<Vertex>();
			best[i][1] = new TreeSet<Vertex>();
		}
		int[] s = new int[n];
		String situation = nextToken();
		assert(situation.length() == n);
		for (int i = 0; i < n; i++) {
			assert(situation.charAt(i) == 'L' || situation.charAt(i) == 'R');
			s[i] = situation.charAt(i) == 'L' ? 0 : 1;
		}
		TreeSet<Pair> roads = new TreeSet<Pair>();
		for (int i = 0; i < m; i++) {
			int a = nextInt() - 1;
			assert((0 <= a) && (a < n));
			int b = nextInt() - 1;
			assert((0 <= b) && (b < n));
			Pair p = new Pair(a, b, 0, 0);
			assert(!roads.contains(p));
			roads.add(p);
			int c = nextInt();
			assert((1 <= c) && (c <= 1e9));
			G[a].add(new Edge(a, b, c));
			G[b].add(new Edge(b, a, c));
			Vertex v1 = new Vertex(b, c, s[b]);
			Vertex v2 = new Vertex(a, c, s[a]);
			nei[a].put(v1.num, v1);
			nei[b].put(v2.num, v2);
			best[a][v1.color].add(v1);
			best[b][v2.color].add(v2);
		}
		TreeSet<Pair> ans = new TreeSet<Pair>();
		for (int i = 0; i < n; i++) {
			if (best[i][s[i]].size() >= 1) {
				Vertex v = best[i][s[i]].first();
				ans.add(new Pair(i, v.num, v.w, -1));
			}
			if (best[i][1 - s[i]].size() >= 2) {
				Vertex v1 = best[i][1 - s[i]].pollFirst();
				Vertex v2 = best[i][1 - s[i]].first();
				best[i][1 - s[i]].add(v1);
				ans.add(new Pair(v1.num, v2.num, v1.w + v2.w, i));
			}
		}
		out.println(ans.first().l + " " + (ans.first().a + 1) + " " + (ans.first().b + 1));
		TreeSet<Integer> revolutions = new TreeSet<Integer>();
		for (int i = 0; i < k; i++) {
			int x = nextInt() - 1;
			assert((0 <= x) && (x < n));
			assert(!revolutions.contains(x));
			revolutions.add(x);
			for (Edge e : G[x]) {
				int y = e.b;
				Vertex v = nei[y].get(x);
				if (s[y] == s[x] && best[y][v.color].first() == v) {
					ans.remove(new Pair(x, y, v.w, -1));
				}
				if (s[y] != s[x] && best[y][v.color].size() >= 2) {
					Vertex v1 = best[y][v.color].pollFirst();
					if (v1 == v || best[y][v.color].first() == v) {
						Vertex v2 = best[y][v.color].first();
						ans.remove(new Pair(v1.num, v2.num, v1.w + v2.w, y));
					}
					best[y][v.color].add(v1);
				}
				best[y][v.color].remove(v);
				v.color = 1 - v.color;
				best[y][v.color].add(v);
				if (v.color == s[y] && best[y][v.color].first() == v) {
					if (best[y][v.color].size() >= 2) {
						best[y][v.color].pollFirst();
						Vertex v1 = best[y][v.color].first();
						ans.remove(new Pair(y, v1.num, v1.w, -1));
						best[y][v.color].add(v);
					}
					ans.add(new Pair(y, x, v.w, -1));
				}
				if (v.color != s[y] && best[y][v.color].size() >= 2) {
					Vertex v1 = best[y][v.color].pollFirst();
					if (v1 == v && best[y][v.color].size() >= 2) {
						Vertex v2 = best[y][v.color].pollFirst();
						Vertex v3 = best[y][v.color].first();
						ans.remove(new Pair(v2.num, v3.num, v2.w + v3.w, y));
						best[y][v.color].add(v2);
					}
					if (v1 != v && best[y][v.color].size() >= 2) {
						Vertex v2 = best[y][v.color].pollFirst();
						if (v2 == v) {
							Vertex v3 = best[y][v.color].first();
							ans.remove(new Pair(v1.num, v3.num, v1.w + v3.w, y));
						}
						best[y][v.color].add(v2);
					}
					Vertex v2 = best[y][v.color].first();
					best[y][v.color].add(v1);
					ans.add(new Pair(v1.num, v2.num, v1.w + v2.num, y));
				}
			}
			s[x] = 1 - s[x];
			out.println(ans.first().l + " " + (ans.first().a + 1) + " " + (ans.first().b + 1));
		}
	}
}
