public class Main
{
public static void main
(String[] args
) {
int i = 1;
int x = 7;
while (x != 1)
{
System.
out.
println(i
+ " " + x
);
if (x % 2 == 0)
{
x = x / 2;
}
else
{
x = x * 3 + 1;
}
i++;
}
System.
out.
println(i
+ " " + x
); }
}
cHVibGljIGNsYXNzIE1haW4KewogICAgcHVibGljIHN0YXRpYyB2b2lkIG1haW4oU3RyaW5nW10gYXJncykKICAgIHsKICAgICAgICBpbnQgaSA9IDE7CiAgICAgICAgaW50IHggPSA3OwoKICAgICAgICB3aGlsZSAoeCAhPSAxKQogICAgICAgIHsKICAgICAgICAgICAgU3lzdGVtLm91dC5wcmludGxuKGkgKyAiICIgKyB4KTsKCiAgICAgICAgICAgIGlmICh4ICUgMiA9PSAwKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICB4ID0geCAvIDI7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZWxzZQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICB4ID0geCAqIDMgKyAxOwogICAgICAgICAgICB9CgogICAgICAgICAgICBpKys7CiAgICAgICAgfQoKICAgICAgICBTeXN0ZW0ub3V0LnByaW50bG4oaSArICIgIiArIHgpOwogICAgfQp9