public static void main(String[] args) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String line = "";
		StringBuilder out = new StringBuilder();
		buildConversion();
		while ((line = in.readLine()) != null && line.length() != 0) {
			line = line.trim();
			if (Character.isDigit(line.charAt(0)))
				out.append(araToRom.get(Integer.parseInt(line)) + "\n");
			else
				out.append(romToAra.get(line) + "\n");

		}
		System.out.print(out);
	}