public class Main {
public static void main
(final String[] args
) { for (int n = 1; n <= 100; n++) {
System.
out.
println(nabeatsu
(n
)); }
}
static String nabeatsu
(final int n
) { return aho
(n
) ? "AHO" : String.
valueOf(n
); }
static boolean aho(final int n) {
return divisible3(n) || contains3(n);
}
static boolean divisible3(final int n) {
return (n % 3) == 0;
}
static boolean contains3(final int n) {
int m = n;
while (m > 0) {
if ((m % 10) == 3) {
return true;
}
m /= 10;
}
return false;
}
}
cHVibGljIGNsYXNzIE1haW4gewogICAgcHVibGljIHN0YXRpYyB2b2lkIG1haW4oZmluYWwgU3RyaW5nW10gYXJncykgewogICAgICAgIGZvciAoaW50IG4gPSAxOyBuIDw9IDEwMDsgbisrKSB7CiAgICAgICAgICAgIFN5c3RlbS5vdXQucHJpbnRsbihuYWJlYXRzdShuKSk7CiAgICAgICAgfQogICAgfQoKICAgIHN0YXRpYyBTdHJpbmcgbmFiZWF0c3UoZmluYWwgaW50IG4pIHsKICAgICAgICByZXR1cm4gYWhvKG4pID8gIkFITyIgOiBTdHJpbmcudmFsdWVPZihuKTsKICAgIH0KCiAgICBzdGF0aWMgYm9vbGVhbiBhaG8oZmluYWwgaW50IG4pIHsKICAgICAgICByZXR1cm4gZGl2aXNpYmxlMyhuKSB8fCBjb250YWluczMobik7CiAgICB9CgogICAgc3RhdGljIGJvb2xlYW4gZGl2aXNpYmxlMyhmaW5hbCBpbnQgbikgewogICAgICAgIHJldHVybiAobiAlIDMpID09IDA7CiAgICB9CgogICAgc3RhdGljIGJvb2xlYW4gY29udGFpbnMzKGZpbmFsIGludCBuKSB7CiAgICAgICAgaW50IG0gPSBuOwogICAgICAgIHdoaWxlIChtID4gMCkgewogICAgICAgICAgICBpZiAoKG0gJSAxMCkgPT0gMykgewogICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgbSAvPSAxMDsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIGZhbHNlOwogICAgfQp9