About increasing decreasing sequence test cases

My code is successful on all test cases except two what are those I tried many inputs and my code is successful in it.
can you figure out what are those test cases this is my code

a=int(input(""))
flag = ‘false’
pos = 0
pos2 = 0
prev = 0

for i in range(a):
x=float(input(""))

if i==0:
    flag = 'true'
    prev = x
elif x > prev:
    if i== pos+1:
        flag = 'true'
        pos = i
        pos2 = i+1
        prev = x
    else:
        flag = 'false'
        
elif x < prev:
    
    if i == pos2+1:
        flag = 'true'
        pos2 = i
        pos = i+1
        prev = x
    else:
        flag = 'false'
        
elif x == prev:
    flag = 'false'

print(flag)

Hey @Nikhil799, please share the IDE online link of your code ???..It is difficult to run this code on my editor to figure out the problem.

Thanks !

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.