Help me in solving DELARR problem

My issue

logic

My code

import java.util.*;
import java.lang.*;
import java.io.*;

class Codechef
{
	public static void main (String[] args) throws java.lang.Exception
	{
	 Scanner sc=new Scanner(System.in);
	  int t=sc.nextInt();
	  while(t-->0){
	      int n=sc.nextInt();
	      int m=sc.nextInt();
	      
	  }

	}
}

Problem Link: Delete the Array Practice Coding Problem - CodeChef