public class Main {
static int stack[] = new int[100],
n,
level;
public static void init() {
stack[level] = -1;
}
public static boolean valid() {return true;}
public static boolean succ() {
if(stack[level]<1){
stack[level]++;
return true;
}
return false;
}
public static boolean sol() {
return (level == n);
}
public static void main
(String args
[]) { n = 3;
bk();
}
public static void bk() {
level = 1;
boolean s,v;
init();
while(level>0){
s = true;
v = false;
while(s && !v){
s = succ();
if(s) v = valid();
}
if(s) {
if(sol())print();
else{
level++;init();
}
}else{
level--;
}
}
}
public static void print() {
for(int i = 1; i <= n; ++i){
if(stack[i] == 1) {
}
}
}
}
cHVibGljIGNsYXNzIE1haW4gewoKICAgICAgIHN0YXRpYyBpbnQgc3RhY2tbXSA9IG5ldyBpbnRbMTAwXSwKICAgICAgICAgICBuLAogICAgICAgICAgIGxldmVsOwoKICAgICAgIHB1YmxpYyBzdGF0aWMgdm9pZCBpbml0KCkgewogICAgICAgICAgICBzdGFja1tsZXZlbF0gPSAtMTsKICAgICAgIH0KCiAgICAgICBwdWJsaWMgc3RhdGljIGJvb2xlYW4gdmFsaWQoKSB7cmV0dXJuIHRydWU7fQoKICAgICAgIHB1YmxpYyBzdGF0aWMgYm9vbGVhbiBzdWNjKCkgewoKICAgICAgICAgICBpZihzdGFja1tsZXZlbF08MSl7CiAgICAgICAgICAgICBzdGFja1tsZXZlbF0rKzsKICAgICAgICAgICAgIHJldHVybiB0cnVlOwogICAgICAgICAgIH0KICAgICAgICAgICByZXR1cm4gZmFsc2U7CiAgICAgICB9CgogICAgICAgcHVibGljIHN0YXRpYyBib29sZWFuIHNvbCgpIHsKICAgICAgICAgcmV0dXJuIChsZXZlbCA9PSBuKTsKICAgICAgIH0KCiAgICAgICBwdWJsaWMgc3RhdGljIHZvaWQgbWFpbihTdHJpbmcgYXJnc1tdKSB7CiAgICAgICAgICAgbiA9IDM7CiAgICAgICAgICAgYmsoKTsKICAgICAgIH0KCiAgICAgICBwdWJsaWMgc3RhdGljIHZvaWQgYmsoKSB7CiAgICAgICAgICBsZXZlbCA9IDE7CiAgICAgICAgICBib29sZWFuIHMsdjsKICAgICAgICAgIGluaXQoKTsKICAgICAgICAgIHdoaWxlKGxldmVsPjApewogICAgICAgICAgICBzID0gdHJ1ZTsKICAgICAgICAgICAgdiA9IGZhbHNlOwogICAgICAgICAgICB3aGlsZShzICYmICF2KXsKICAgICAgICAgICAgICBzID0gc3VjYygpOwogICAgICAgICAgICAgIGlmKHMpIHYgPSB2YWxpZCgpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmKHMpIHsKICAgICAgICAgICAgIGlmKHNvbCgpKXByaW50KCk7CiAgICAgICAgICAgICBlbHNlewogICAgICAgICAgICAgICBsZXZlbCsrO2luaXQoKTsKICAgICAgICAgICAgIH0KICAgICAgICAgICAgfWVsc2V7CiAgICAgICAgICAgICAgbGV2ZWwtLTsKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgfQoKICAgICAgIHB1YmxpYyBzdGF0aWMgdm9pZCBwcmludCgpIHsKCiAgICAgICAgIGZvcihpbnQgaSA9IDE7IGkgPD0gbjsgKytpKXsKICAgICAgICAgICBpZihzdGFja1tpXSA9PSAxKSB7CiAgICAgICAgICAgICBTeXN0ZW0ub3V0LnByaW50KGkgKyAiICIpOwogICAgICAgICAgIH0KICAgICAgICAgfQogICAgICAgICBTeXN0ZW0ub3V0LnByaW50bG4oIlxuIik7CiAgICAgICB9Cn0K