Problem: You need to find a binary tree of size n that satisfies a given set of c constraints. Suppose that the nodes of the unknown binary tree are labeled using a pre-order traversal starting with 1. For the i-th constraint you are given two labels, ai and bi and a direction, left or right. In case of left direction, bi is an element of the subtree rooted at ai's left child. Similarly in the case of right direction bi is an element of the subtree rooted at ai's right child.

Input

The first line of input contains two integers n and c. The next c lines contain 2 integers ai, bi (1 ≤ ai, bi ≤ n) and either "LEFT" or "RIGHT" denoting whether b is in the subtree rooted at ai's left child or in the subtree rooted at ai's right child.

The problem consists of multiple subproblems. The subproblems have different constraints on the input. You will get some score for the correct submission of the subproblem. The description of the subproblems follows.

  * In subproblem D1 (9 points), the constraints 1 ≤ n ≤ 100, 1 ≤ c ≤ 50 will hold. 
  * In subproblem D2 (8 points), the constraints 1 ≤ n ≤ 1000000, 1 ≤ c ≤ 100000 will hold. 

Output

Output will be on a single line.

Any binary tree that satisfies the constraints will be accepted. The tree's nodes should be printed out as n space separated labels representing an in-order traversal, using the pre-order numbers as labels of vertices.

If there are no trees that satisfy the constraints, print "IMPOSSIBLE" (without quotes).

Examples

Input

3 2
1 2 LEFT
1 3 RIGHT


Output

2 1 3


Input

3 2
1 2 RIGHT
1 3 LEFT


Output

IMPOSSIBLE

Note

Consider the first sample test. We need to find a tree with 3 nodes that satisfies the following two constraints. The node labeled 2 with pre-order traversal should be in the left subtree of the node labeled 1 with pre-order traversal; the node labeled 3 with pre-order traversal should be in the right subtree of the node labeled 1. There is only one tree with three nodes that satisfies these constraints and its in-order traversal is (2, 1, 3).

Pre-order is the "root – left subtree – right subtree" order. In-order is the "left subtree – root – right subtree" order.

For other information regarding in-order and pre-order, see <http://en.wikipedia.org/wiki/Tree_traversal>.

Solution (in JAVA):

Solution:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;

public class D {
	static InputStreamReader isr = new InputStreamReader(System.in);
	static BufferedReader br = new BufferedReader(isr);

	static int[] readIntArray() throws IOException {
		String[] v = br.readLine().split(" ");
		int[] ans = new int[v.length];

		for (int i = 0; i < ans.length; i++) {
			ans[i] = Integer.valueOf(v[i]);
		}

		return ans;
	}

	static int n;
	static int c;
	static int[][] con;
	static HashMap<Integer, HashSet<Integer>> leftDesc;
	static HashMap<Integer, HashSet<Integer>> rightDesc;
	static int[] rightMostDesc;
	static int[] rightMostLeftDesc;
	static int[] leftMostDesc;
	static int[] leftMostRightDesc;
	static boolean impossible = false;
	static int[] inorder;

	public static void main(String[] args) throws IOException {
		int[] d = readIntArray();

		n = d[0];
		inorder = new int[n];
		c = d[1];

		leftDesc = new HashMap<Integer, HashSet<Integer>>();
		rightDesc = new HashMap<Integer, HashSet<Integer>>();
		rightMostDesc = new int[n + 1];
		rightMostLeftDesc = new int[n + 1];
		leftMostDesc = new int[n + 1];
		leftMostRightDesc = new int[n + 1];
		for (int i = 1; i <= n; i++) {
			leftDesc.put(i, new HashSet<Integer>());
			rightDesc.put(i, new HashSet<Integer>());
			rightMostDesc[i] = Integer.MIN_VALUE;
			rightMostLeftDesc[i] = Integer.MIN_VALUE;
			leftMostDesc[i] = Integer.MAX_VALUE;
			leftMostRightDesc[i] = Integer.MAX_VALUE;
		}

		con = new int[c][3];
		for (int i = 0; i < c; i++) {
			String[] v = br.readLine().split(" ");
			con[i][0] = Integer.valueOf(v[0]);
			con[i][1] = Integer.valueOf(v[1]);

			if(con[i][0] == con[i][1]) {
				System.out.println("IMPOSSIBLE");
				return;
			}
			
			if (v[2].equals("LEFT")) {
				con[i][2] = 1;
				leftDesc.get(con[i][0]).add(con[i][1]);
				rightMostLeftDesc[con[i][0]] = Math.max(
						rightMostLeftDesc[con[i][0]], con[i][1]);
			} else {
				con[i][2] = 2;
				rightDesc.get(con[i][0]).add(con[i][1]);
				leftMostRightDesc[con[i][0]] = Math.min(
						leftMostRightDesc[con[i][0]], con[i][1]);
			}

			rightMostDesc[con[i][0]] = Math.max(rightMostDesc[con[i][0]],
					con[i][1]);
			leftMostDesc[con[i][0]] = Math.min(leftMostDesc[con[i][0]],
					con[i][1]);
		}

		StringBuilder ans = solve(1, n);

		if (impossible)
			System.out.println("IMPOSSIBLE");
		else {
			System.out.println(ans.toString());
		}
	}

	static StringBuilder solve(int l, int r) {
		if (l == r) {
			return new StringBuilder(Integer.toString(l));
		}

		if (l > r) {
			return new StringBuilder();
		}

		int rm = rightMostLeftDesc[l];
		if (rm == Integer.MIN_VALUE) {
			int min = leftMostRightDesc[l];
			for (int i = r; i >= l + 1; i--) {
				min = Math.min(leftMostDesc[i], min);
			}
			if (min <= l) {
				impossible = true;
				return new StringBuilder();
			}
			
			StringBuilder ans = new StringBuilder(Integer.toString(l));
			StringBuilder subt = solve(l + 1, r);
			if (subt.length() > 0) {
				ans.append(" ");
				ans.append(subt);
			}

			return ans;
		} else {
			int cur = l + 1;
			while (cur <= rm) {
				rm = Math.max(rm, rightMostDesc[cur]);
				cur++;
			}

			if (rm > r) {
				impossible = true;
				return new StringBuilder();
			} else {

				int min = leftMostRightDesc[l];
				for (int i = r; i >= rm + 1; i--) {
					min = Math.min(leftMostDesc[i], min);
				}
				if (min <= rm) {
					impossible = true;
					return new StringBuilder();
				}

				StringBuilder lt = solve(l + 1, rm);
				StringBuilder rt = solve(rm + 1, r);
				StringBuilder ans = new StringBuilder();
				ans.append(lt);
				if (ans.length() > 0) {
					ans.append(' ');
				}
				ans.append(Integer.toString(l));
				if (rt.length() > 0) {
					ans.append(' ');
					ans.append(rt);
				}

				return ans;
			}
		}

	}

	static class Tree {
		int[] d;
		int[] min;
		int[] max;
		int n;

		public Tree(int[] d) {
			this.d = d;
			this.min = new int[10 * d.length];
			Arrays.fill(this.min, Integer.MAX_VALUE);
			this.max = new int[10 * d.length];
			Arrays.fill(this.max, Integer.MIN_VALUE);
			this.n = d.length;

			for (int i = 0; i < d.length; i++) {
				set(i, d[i]);
			}
		}

		void set(int ind, int val) {
			internalSet(0, 0, n, ind, val);
		}

		void internalSet(int root, int rl, int rr, int ind, int val) {
			if (ind < rl || ind > rr)
				return;

			if (rl == rr) {
				this.min[rl] = this.max[rl] = val;
				return;
			}

			this.min[root] = Math.min(this.min[root], val);
			this.max[root] = Math.max(this.max[root], val);

			int mid = (rl + rr) / 2;
			internalSet(2 * root + 1, rl, mid, ind, val);
			internalSet(2 * root + 2, mid + 1, rr, ind, val);
		}

		int internalGetMin(int root, int rl, int rr, int ql, int qr) {
			if (qr < rl || ql > rr) {
				return Integer.MAX_VALUE;
			}

			if (rl == rr) {
				return this.min[rl];
			}

			int mid = (rl + rr) / 2;
			int m1 = internalGetMin(2 * root + 1, rl, mid, ql, qr);
			int m2 = internalGetMin(2 * root + 2, mid + 1, rr, ql, qr);

			int ans = Integer.MAX_VALUE;
			if (m1 != Integer.MAX_VALUE) {
				ans = Math.min(ans, m1);
			}
			if (m2 != Integer.MAX_VALUE) {
				ans = Math.min(ans, m2);
			}

			return ans;
		}

		public int getMin(int l, int r) {
			return internalGetMin(0, 0, this.n, l, r);
		}

		public int getMax(int l, int r) {
			return internalGetMax(0, 0, this.n, l, r);
		}

		private int internalGetMax(int root, int rl, int rr, int ql, int qr) {
			if (qr < rl || ql > rr) {
				return Integer.MIN_VALUE;
			}

			if (rl == rr) {
				return this.min[rl];
			}

			int mid = (rl + rr) / 2;
			int m1 = internalGetMax(2 * root + 1, rl, mid, ql, qr);
			int m2 = internalGetMax(2 * root + 2, mid + 1, rr, ql, qr);

			int ans = Integer.MIN_VALUE;
			if (m1 != Integer.MIN_VALUE) {
				ans = Math.max(ans, m1);
			}
			if (m2 != Integer.MIN_VALUE) {
				ans = Math.max(ans, m2);
			}

			return ans;
		}

	}

}