Alternatively, you could just change:
y = input.nextInt();
To:
y = x.nextInt();
Then it will work.
This is because input is not defined anywhere in the code. The provided code suggests that you expect it to be an instance of the Scanner class. But the instance of Scanner class is actually defined as x and not input.