Increment decrement sequence

sir why my code could not pass test case 7 and 3.
sir these is my code.
#include
using namespace std;
//strically increasing or decreasing
int main()
{
int n;
cin>>n;
int i=1;
int d;
cin>>d;
int a=1;
int b=1;
while(i<n)
{

int m=d;
cin>>d;
if(d>m)
{
  a++;
}
else if(d<m)
{
 b++;
}
i++;

}
if((a==n)||(b==n))
{
cout<<“true”<<endl;
}
else
{
cout<<“false”<<endl;
}
return 0;

}

@YASHMATHURIA123
dry run your code for
5
5
4
3
4
5
ans shd be true