Need help with the question

Here is the interview problem for Exawizards intern and I’m unable to find an approach for this problem. Please help out!!

Thanks in advance

I am getting this Error bro can anyone help me
Error : error: class chef_on_vacaton_codecheff is public, should be declared in a file named
public class chef_on_vacaton_codecheff{
1 error

import java.util.Scanner;
public class chef_on_vacaton_codecheff{
static Scanner sc = new Scanner(;
static void trip(){
int x=sc.nextInt(),y=sc.nextInt(),z=sc.nextInt();
else System.out.println(“NO”);
public static void main(String[]arg){
int tc = sc.nextInt();