#include <bits/stdc++.h>
#define ll long long
using namespace std;
int n,m,k;ll mod;
int read(){
	char ch=getchar();int x=0,f=1;
	for(;ch<'0'||'9'<ch;ch=getchar())if(ch=='-')f=-1;
	for(;'0'<=ch&&ch<='9';ch=getchar())x=x*10+(ch-'0');
	return f*x;
}
int main(){
    for(int _t=read();_t;_t--){
        int x=read(),y=read();
        if(x>y){
            printf("NO\n");
            continue;
        }
        int num1=0,num2=0;
        bool bo=1;
        for(int i=0;i<=30;i++){
            if((1<<i)&x)num1++;
            if((1<<i)&y)num2++;
            if(num2>num1){
                printf("NO\n");
                bo=0;break;
            }
        }
        if(bo)printf("YES\n");
    }
    return 0;
}