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

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

	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());
	}

	final int MAXLEN = 3000;
	final int MAXNUM = 3000;

	int[] lead;
	int[] eq;
	int left, right;

	public int get(int v) {
		if (lead[v] != v) {
			lead[v] = get(lead[v]);
		}
		return lead[v];
	}

	Random rnd;

	public void unite(int u, int v, int ch) {
		if (rnd.nextBoolean()) {
			lead[u] = v;
			eq[v] = ch;
		} else {
			lead[v] = u;
			eq[u] = ch;
		}
	}

	public boolean equalize() {
		int i = left + 1;
		int j = right - 1;
		while (i < j) {
			if (eq[get(i)] != -1 && eq[get(j)] != -1
					&& eq[get(i)] != eq[get(j)]) {
				return false;
			}
			int ch;
			if (eq[get(i)] != -1) {
				ch = eq[get(i)];
			} else {
				ch = eq[get(j)];
			}
			if (ch == -1) {
				assert (eq[get(i)] == -1 && eq[get(j)] == -1);
			}
			if (get(i) != get(j)) {
				unite(get(i), get(j), ch);
			}
			i++;
			j--;
		}
		return true;
	}

	public void solve() throws IOException {
		int n = nextInt();
		int m = nextInt();

		assert (1 <= n && n <= MAXLEN);
		assert (1 <= m && m <= MAXNUM);

		rnd = new Random(9456);
		String[] s = new String[m];

		long sum = 0;
		for (int i = 0; i < m; i++) {
			s[i] = nextToken();
			assert (s[i].length() > 0);
			sum += s[i].length();
		}
		assert (sum <= MAXNUM);

		String w = nextToken();
		assert (w.length() == m);

		lead = new int[MAXLEN * 4];
		eq = new int[MAXLEN * 4];
		Arrays.fill(eq, -1);
		for (int i = 0; i < lead.length; i++) {
			lead[i] = i;
		}
		left = MAXLEN - 1;
		right = MAXLEN + n;
		equalize();
		for (int i = 0; i < m - 1; i++) {
			if (w.charAt(i) == 'L') {
				for (int j = s[i].length() - 1; j >= 0; j--) {
					eq[left] = s[i].charAt(j);
					left--;
				}
			} else {
				for (int j = 0; j < s[i].length(); j++) {
					eq[right] = s[i].charAt(j);
					right++;
				}
			}
			if (!equalize()) {
				out.println("Impossible");
				return;
			}
		}
		boolean ambigous = false;
		for (int i = 0; i < n; i++) {
			if (eq[get(MAXLEN + i)] == -1) {
				ambigous = true;
				break;
			}
		}
		{
			if (w.charAt(m - 1) == 'L') {
				for (int j = s[m - 1].length() - 1; j >= 0; j--) {
					eq[left] = s[m - 1].charAt(j);
					left--;
				}
			} else {
				for (int j = 0; j < s[m - 1].length(); j++) {
					eq[right] = s[m - 1].charAt(j);
					right++;
				}
			}
			if (equalize() && !ambigous) {
				out.println("Impossible");
				return;
			}
		}

		if (ambigous) {
			out.println("Ambiguous");
			return;
		} else {
			out.println("Unique");
		}
	}

	public void run() {
		try {
			Locale.setDefault(Locale.US);
			br = new BufferedReader(new FileReader("game.in"));
			out = new PrintWriter("game.out");

			solve();

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