import std.experimental.all; T read(T)() { return readln.chomp.to!T; } T[] reads(T)() { return readln.split.to!(T[]); } alias readint = read!int; alias readints = reads!int; void calc(int[][] xs) { xs.sort!((a, b) => a[0] == b[0] ? a[1] < b[1] : a[0] > b[0]); foreach (x; xs) { char c = to!char(x[2] + 'A'); writeln(c); } } void main() { auto a = readints; auto b = readints; auto c = readints; calc([a ~= 0, b ~= 1, c ~= 2]); }