knight move problem(there is a wrong sign showing in code but i cant figure out)

knight move problem(there is a wrong sign showing in code but i cant figure out)
the code is
#include
#include
#include<string.h>
#include
using namespace std;

int valid(char *);
int main()
{

	int n;
	scanf("%d",&n);
	char move[13];
	int flag;
	int x,y;
	for(int i=0;i<n;i++){
		scanf("%s",move);
		if(valid(move)){
			x=abs(move[0]-move[3]);
			y=abs(move[1]-move[4]);
			if((x==1 && y==2) || (x==2 && y==1) ){
				flag=1;
			}
			else flag=0;
			if(flag)printf("Yes\n");
			else printf("No\n");
		}
		else{
			printf("Error\n");
			}


		}

		 return 0;
	}



int valid(char x[]){

	if(strlen(x)==5 && x[2]=='-'){
		if(x[0]>96 && x[0]<105 && x[3]>96 && x[3]<105 && x[1]>48 && x[1]<57 && x[4]>48 && x[4]<57)
			{return 1;}}
	 return 0;
	}