Help me in solving TEMPLELA problem

My issue

I am getting error at reading test cases, error is EOF(end of file).How can I solve that?(I have tried using try and except but now my program is running with no inputs)

My code

# cook your dish here
try:
    t=int(input())
    for i in range(0,t):
        n=int(input())
        lt=list(map(int,input().split()))
        l=len(lt)
        f=0
        if(l%2==0):
            print('no')
        else:
            for j in range(0,l):
                if(j<(n-1)/2):
                    if(lt[j+1]-lt[j]==1):
                        f=1
                    else:
                        f=0
                        break
                elif(j>(n-1)/2):
                    if(lt[j]-lt[j+1]==1 and j+1<l):
                        f=1
                    else:
                        f=0
                        break
                else:
                    if(lt[j]-lt[j+1]==1 and lt[j]-lt[j-1]==1):
                        f=1
                    else:
                        f=0
                        break
        if(f==0):
            print('no')
        else:
            print('yes')
except:
    pass
                
            

Problem Link: Temple Land Practice Coding Problem - CodeChef

@sathvikareddy2
plzz refer my c++ code

#include <bits/stdc++.h>
using namespace std;

int main() {
	// your code goes here
	int t;
	cin>>t;
	while(t--)
	{
	    int n;
	    cin>>n;
	    int a[n];
	    for(int i=0;i<n;i++)
	    {
	        cin>>a[i];
	    }
	    if(n%2==0)
	   cout<<"no";
	   else
	   {
	       if(a[n/2]==(n+1)/2)
	       {
	           int ch=0;
	           for(int i=n/2-1;i>=0;i--)
	           {
	               if(a[i+1]-a[i]!=1)
	               {
	                   ch=1;
	               }
	           }
	           for(int i=n/2+1;i<n;i++)
	           {
	               if(a[i-1]-a[i]!=1)
	               {
	                   ch=1;
	               }
	           }
	           if(ch)
	           cout<<"no";
	           else
	           cout<<"yes";
	       }
	       else
	       cout<<"no";
	   }
	   cout<<endl;
	   
	}

}

def is_valid_strip(N, heights):
center = N // 2
left_heights = heights[:center]
right_heights = heights[center+1:][::-1]

return heights[0] == 1 and heights[-1] == 1 and left_heights == sorted(set(left_heights)) and right_heights == sorted(set(right_heights))

def main():
S = int(input())
for _ in range(S):
Ni = int(input())
heights = list(map(int, input().split()))
result = “yes” if is_valid_strip(Ni, heights) else “no”
print(result)

if name == “main”:
main()

LIKE IF IT IS HELPFUL