#include<bits/stdc++.h>
using namespace std;
int _,x,y;
int main(){
	scanf("%d",&_);
	while(_--){
		bool ff=0;
		int s1=0,s2=0;
		scanf("%d%d",&x,&y);
		if(x>y){puts("NO");ff=1;}
		while(y&&(!ff)){
			s1+=(x&1);	s2+=(y&1);
			if(s1<s2){
				puts("NO");ff=1;
				break;
			}
			x>>=1;	y>>=1;
		}
		if(!ff)puts("YES");
	}
} 