import core.bitop; import std.algorithm; import std.array; import std.ascii; import std.container; import std.conv; import std.format; import std.math; import std.range; import std.stdio; import std.string; import std.typecons; void main() { int n = readln.chomp.to!int; auto c = readln.chomp.split.map!(to!int).filter!"a != 0"; if (c.any!"a >= 3") { "B".writeln; return; } if (c.count(2) >= 2) { "B".writeln; } writeln = c.filter!(a => a <= 2).sum() % 2 == 1 ? "A" : "B"; }