Help me in solving PR0BLEM problem

My code is failing for some cases. Can anyone tell me error in my code.

My code

#include <iostream>
using namespace std;

int main() {
	int t;
	cin >> t;
	for(int i=1;i<=t;i++){
	    int n,m,c,d;
	    cin >> n >> m;
	    c=n;
	    d=m;
	    
	    if(c>d){
	        n--;
	        m++;
	        
	    }
	    if(d>c){
	        m--;
	        n = n+3;
	    }
	    if(m==n){
	        cout << "YES" << endl;
	    }
	    if(m!=n){
	        cout << "NO" << endl;
	    }
	}
	return 0;
}

Problem Link: PR0BLEM Problem - CodeChef

@kunalgunwal
for test case
1
2 54
your output is NO
but the correct answer would be yes.