#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<climits>
#include<string>
#include<vector>
#include<map>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<algorithm>

#define ll long long
#define dl double
#define mod 1000000007
#define sz 100005
#define szz 25005
#define PI 3.14159265

using namespace std;

class code
{
public:
    ll h,m;
};

code arr[sz];

int main()
{
    ll n,s;

    scanf("%lld %lld",&n,&s);

    for(ll i=1; i<=n; i++)
    {
        scanf("%lld %lld",&arr[i].h,&arr[i].m);
    }

    arr[0].h=0;
    arr[0].m=0;

    ll ss=arr[1].h,ff=arr[1].m;

    if(ff<s)
    {
        ss--;
        ff=(ff+60)-s;
    }

    else
    {
        ff=ff-s;
    }

    if(ss>=0&&ff>=1)
    {
        printf("0 0\n");
    }

    else
    {
        ll flag=0;

        for(ll i=2; i<=n; i++)
        {
            ll aa=arr[i-1].h;
            ll bb=arr[i-1].m;
            ll xx=arr[i].h;
            ll yy=arr[i].m;

            bb+=(s+1);

            if(bb>=60)
            {
                ll r=(bb/60);

                bb=bb-(r*60);
                aa+=r;
            }

            if(yy<s)
            {
                xx--;
                yy=(yy+60)-s;
            }

            else
            {
                yy=yy-s;
            }

            if(aa<xx)
            {
                printf("%lld %lld\n",aa,bb);
                flag=1;
                break;
            }

            else if(aa==xx)
            {
                if(bb<yy)
                {
                    printf("%lld %lld\n",aa,bb);
                    flag=1;
                    break;
                }
            }
        }

        if(flag==0)
        {
            arr[n].m+=(s+1);

            if(arr[n].m>=60)
            {
                ll r=(arr[n].m)/60;

                arr[n].h+=r;
                arr[n].m=arr[n].m-(r*60);
            }

            printf("%lld %lld\n",arr[n].h, arr[n].m);
        }
    }

    return (0);
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<climits>
#include<string>
#include<vector>
#include<map>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<algorithm>

#define ll long long
#define dl double
#define mod 1000000007
#define sz 100005
#define szz 25005
#define PI 3.14159265

using namespace std;

class code
{
public:
    ll h,m;
};

code arr[sz];

int main()
{
    ll n,s;

    scanf("%lld %lld",&n,&s);

    for(ll i=1; i<=n; i++)
    {
        scanf("%lld %lld",&arr[i].h,&arr[i].m);
    }

    arr[0].h=0;
    arr[0].m=0;

    ll ss=arr[1].h,ff=arr[1].m;

    if(ff<s)
    {
        ss--;
        ff=(ff+60)-s;
    }

    else
    {
        ff=ff-s;
    }

    if(ss>=1)
    {
        printf("0 0\n");
    }

    else if(ss>=0&&ff<=1)
    {
        printf("0 0\n");
    }

    else
    {
        ll flag=0;

        for(ll i=2; i<=n; i++)
        {
            ll aa=arr[i-1].h;
            ll bb=arr[i-1].m;
            ll xx=arr[i].h;
            ll yy=arr[i].m;

            bb+=(s+1);

            if(bb>=60)
            {
                ll r=(bb/60);

                bb=bb-(r*60);
                aa+=r;
            }

            if(yy<s)
            {
                xx--;
                yy=(yy+60)-s;
            }

            else
            {
                yy=yy-s;
            }

            if(aa<xx)
            {
                printf("%lld %lld\n",aa,bb);
                flag=1;
                break;
            }

            else if(aa==xx)
            {
                if(bb<yy)
                {
                    printf("%lld %lld\n",aa,bb);
                    flag=1;
                    break;
                }
            }
        }

        if(flag==0)
        {
            arr[n].m+=(s+1);

            if(arr[n].m>=60)
            {
                ll r=(arr[n].m)/60;

                arr[n].h+=r;
                arr[n].m=arr[n].m-(r*60);
            }

            printf("%lld %lld\n",arr[n].h, arr[n].m);
        }
    }

    return (0);
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<climits>
#include<string>
#include<vector>
#include<map>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<algorithm>

#define ll long long
#define dl double
#define mod 1000000007
#define sz 100005
#define szz 25005
#define PI 3.14159265

using namespace std;

class code
{
public:
    ll h,m;
};

code arr[sz];

int main()
{
    ll n,s;

    scanf("%lld %lld",&n,&s);

    for(ll i=1; i<=n; i++)
    {
        scanf("%lld %lld",&arr[i].h,&arr[i].m);
    }

    arr[0].h=0;
    arr[0].m=0;

    ll ss=arr[1].h,ff=arr[1].m;

    if(ff<s)
    {
        ss--;
        ff=(ff+60)-s;
    }

    else
    {
        ff=ff-s;
    }

    if(ss>=0&&ff>=2)
    {
        printf("0 0\n");
    }

    else
    {
        ll flag=0;

        for(ll i=2; i<=n; i++)
        {
            ll aa=arr[i-1].h;
            ll bb=arr[i-1].m;
            ll xx=arr[i].h;
            ll yy=arr[i].m;

            bb+=(s+1);

            if(bb>=60)
            {
                bb=bb-60;
                aa+=1;
            }

            if(yy<s)
            {
                xx--;
                yy=(yy+60)-s;
            }

            else
            {
                yy=yy-s;
            }

            if(aa<xx)
            {
                printf("%lld %lld\n",aa,bb);
                flag=1;
                break;
            }

            else if(aa==xx)
            {
                if(bb<yy)
                {
                    printf("%lld %lld\n",aa,bb);
                    flag=1;
                    break;
                }
            }
        }

        if(flag==0)
        {
            arr[n].m+=(s+1);

            if(arr[n].m>=60)
            {
                arr[n].h+=1;
                arr[n].m=arr[n].m-60;
            }

            printf("%lld %lld\n",arr[n].h, arr[n].m);
        }
    }

    return (0);
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<climits>
#include<string>
#include<vector>
#include<map>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<algorithm>

#define ll long long
#define dl double
#define mod 1000000007
#define sz 100005
#define szz 25005
#define PI 3.14159265

using namespace std;

class code
{
public:
    ll h,m;
};

code arr[sz];

int main()
{
    ll n,s;

    scanf("%lld %lld",&n,&s);

    for(ll i=1; i<=n; i++)
    {
        scanf("%lld %lld",&arr[i].h,&arr[i].m);
    }

    arr[0].h=0;
    arr[0].m=0;

    ll ss=arr[1].h,ff=arr[1].m;

    if(ff<s)
    {
        ss--;
        ff=(ff+60)-s;
    }

    else
    {
        ff=ff-s;
    }

    // printf("%lld %lld\n",ss,ff);

    if(ss>=0)
    {
        if(ss>=1||ff>=1)
            printf("0 0\n");
    }

    else
    {
        ll flag=0;

        for(ll i=2; i<=n; i++)
        {
            ll aa=arr[i-1].h;
            ll bb=arr[i-1].m;
            ll xx=arr[i].h;
            ll yy=arr[i].m;

            bb+=(s+1);

            if(bb>=60)
            {
                ll r=(bb/60);

                bb=bb-(r*60);
                aa+=r;
            }

            if(yy<s)
            {
                xx--;
                yy=(yy+60)-s;
            }

            else
            {
                yy=yy-s;
            }

            if(aa<xx)
            {
                printf("%lld %lld\n",aa,bb);
                flag=1;
                break;
            }

            else if(aa==xx)
            {
                if(bb<yy)
                {
                    printf("%lld %lld\n",aa,bb);
                    flag=1;
                    break;
                }
            }
        }

        if(flag==0)
        {
            arr[n].m+=(s+1);

            if(arr[n].m>=60)
            {
                ll r=(arr[n].m)/60;

                arr[n].h+=r;
                arr[n].m=arr[n].m-(r*60);
            }

            printf("%lld %lld\n",arr[n].h, arr[n].m);
        }
    }

    return (0);
}


include <iostream>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <map>
typedef long long ll;
using namespace std;

int main()
{
    int h[105],m[105];
    int i,n,s;
    int mm,mm1,hh;
    cin>>n>>s;
    for(int i=0; i<n; i++)
    {
        cin>>h[i]>>m[i];
    }
    if(s<m[0]+60*h[0])
    {
        cout<<0<<" "<<0<<endl;
    }
    else
    {
        for(i=0; i<n-1; i++)
        {
            mm=m[i]+s+1+60*h[i];
            mm1=m[i+1]+60*h[i+1];
            if(mm1-mm>s)
            {
                mm=m[i]+s+1;
                hh=h[i];
                while(mm>59)
                {
                    mm-=60;
                    hh++;
                }
                cout<<hh<<" "<<mm<<endl;
                break;
            }
        }
        if(i==n-1)
        {
            mm=m[i]+s+1;
            hh=h[i];
            while(mm>59)
            {
                mm-=60;
                hh++;
            }
            cout<<hh<<" "<<mm<<endl;
        }
    }
    return 0;
}


#include <iostream>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <map>
typedef long long ll;
using namespace std;

int main()
{
    int h[30],m[65];
    int i,n,s;
    int mm,mm1,hh;
    cin>>n>>s;
    for(int i=0; i<n; i++)
    {
        cin>>h[i]>>m[i];
    }
    if(2*s+1<m[0]+60*h[0])
    {
        cout<<0<<" "<<0<<endl;
    }
    else
    {
        for(i=0; i<n-1; i++)
        {
            mm=m[i]+s+1+60*h[i];
            mm1=m[i+1]+60*h[i+1];
            if(mm1-mm>s)
            {
                mm=m[i]+s+1;
                hh=h[i];
                while(mm>59)
                {
                    mm-=60;
                    hh++;
                }
                cout<<hh<<" "<<mm<<endl;
                break;
            }
        }
        if(i==n-1)
        {
            mm=m[i]+s+1;
            hh=h[i];
            while(mm>59)
            {
                mm-=60;
                hh++;
            }
            cout<<hh<<" "<<mm<<endl;
        }
    }

    return 0;
}
/*
3 15
0 32
1 0
12 0
*/


#include <iostream>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <map>
typedef long long ll;
using namespace std;

int main()
{
    int h[105],m[105];
    int i,n,s;
    int mm,mm1,hh;
    cin>>n>>s;
    for(int i=0; i<n; i++)
    {
        cin>>h[i]>>m[i];
    }
    if(s<m[0]+60*h[0])
    {
        cout<<0<<" "<<0<<endl;
    }
    else
    {
        for(i=0; i<n-1; i++)
        {
            mm=m[i]+s+1+60*h[i];
            mm1=m[i+1]+60*h[i+1];
            if(mm1-mm>s)
            {
                mm=m[i]+s+1;
                hh=h[i];
                while(mm>59)
                {
                    mm-=60;
                    hh++;
                }
                cout<<hh<<" "<<mm<<endl;
                break;
            }
        }
        if(i==n-1)
        {
            mm=m[i]+s+1;
            hh=h[i];
            while(mm>59)
            {
                mm-=60;
                hh++;
            }
            cout<<hh<<" "<<mm<<endl;
        }
    }
    return 0;
}


#include <iostream>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <map>
typedef long long ll;
using namespace std;

int main()
{
    int h[30],m[65];
    int i,n,s;
    int mm,mm1,hh;
    cin>>n>>s;
    for(int i=0; i<n; i++)
    {
        cin>>h[i]>>m[i];
    }
    if(s<m[0]+60*h[0])
    {
        cout<<0<<" "<<0<<endl;
    }
    else
    {
        for(i=0; i<n-1; i++)
        {
            mm=m[i]+s+1+60*h[i];
            mm1=m[i+1]+60*h[i+1];
            if(mm1-mm>s)
            {
                mm=m[i]+s+1;
                hh=h[i];
                while(mm>59)
                {
                    mm-=60;
                    hh++;
                }
                cout<<hh<<" "<<mm<<endl;
                break;
            }
        }
        if(i==n-1)
        {
            mm=m[i]+s+1;
            hh=h[i];
            while(mm>59)
            {
                mm-=60;
                hh++;
            }
            cout<<hh<<" "<<mm<<endl;
        }
    }

    return 0;
}
/*
16 60
0 30
1 20
3 0
4 30
6 10
7 50
9 30
11 10
12 50
14 30
16 10
17 50
19 30
21 10
22 50
23 59
*/


#include <iostream>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <map>
typedef long long ll;
using namespace std;

int h[30],m[65];
int main()
{
    int i,n,s;
    int mm,mm1,hh;
    cin>>n>>s;
    for(int i=0; i<n; i++)
    {
        cin>>h[i]>>m[i];
    }
    if(s<m[0]+60*h[0])
    {
        cout<<0<<" "<<0<<endl;
    }
    else
    {
        for(i=0; i<n-1; i++)
        {
            mm=m[i]+s+1+60*h[i];
            mm1=m[i+1]+60*h[i+1];
            if(mm1-mm>s)
            {
                mm=m[i]+s+1;
                if(mm>59)
                {
                    mm-=60;
                    hh=h[i]+1;
                }
                cout<<hh<<" "<<mm<<endl;
                break;
            }
        }
        if(i==n-1)
        {
            mm=m[i]+s+1;
            if(mm>59)
            {
                mm-=60;
                hh=h[i]+1;

            }
            cout<<hh<<" "<<mm<<endl;
        }
    }

    return 0;
}
/*
3 29
0 30
1 0
12 0
*/


#include <iostream>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <map>
typedef long long ll;
using namespace std;

int main()
{
    int h[30],m[65];
    int i,n,s;
    int mm,mm1,hh;
    cin>>n>>s;
    for(int i=0; i<n; i++)
    {
        cin>>h[i]>>m[i];
    }
    if(s<m[0]+60*h[0])
    {
        cout<<0<<" "<<0<<endl;
    }
    else
    {
        for(i=0; i<n-1; i++)
        {
            mm=m[i]+s+1+60*h[i];
            mm1=m[i+1]+60*h[i+1];
            if(mm1-mm>s)
            {
                mm=m[i]+s+1;
                hh=h[i];
                if(mm>59)
                {
                    mm-=60;
                    hh++;
                }
                cout<<hh<<" "<<mm<<endl;
                break;
            }
        }
        if(i==n-1)
        {
            mm=m[i]+s+1;
            hh=h[i];
            if(mm>59)
            {
                mm-=60;
                hh++;

            }
            cout<<hh<<" "<<mm<<endl;
        }
    }

    return 0;
}
/*
3 30
0 30
1 0
12 0
*/


#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<string>
using namespace std;
int num[100];
int main()
{

    int n,s;
    int i,j;
    int h,m;
    int flag;
    cin>>n>>s;
    for(int kk=0;kk<n;kk++)
    {
        cin>>h>>m;
        num[kk] = h*60+m;
    }

    if(s+1<num[0])
    {
        cout<<"0 0"<<endl;
    }
    else
    {
       flag=0;
       for(i=1;i<n-1;i++)
       {
        if(num[i]+2+s*2 <num[i+1])
        {
            flag=1;
            break;
        }
      }
       if(flag!=0)
      {
        num[i]= num[i]+s+1;
        cout<<num[i]/60<<" "<<num[i]%60<<endl;
      }
       else
      {
        num[n-1] = num[n-1]+s+1;
        cout<<num[n-1]/60<<" "<<num[n-1]%60<<endl;
      }
      }

}


#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<string>
using namespace std;
int num[100];
int main()
{

    int n,s;
    int i,j;
    int h,m;
    int flag;
    cin>>n>>s;
    for(int kk=0;kk<n;kk++)
    {
        cin>>h>>m;
        num[kk] = h*60+m;
    }

    if(s+1<=num[0])
    {
        cout<<"0 0"<<endl;
    }
    else
    {
       flag=0;
       for(i=1;i<n-1;i++)
       {
        if(num[i]+2+s*2 <num[i+1])
        {
            flag=1;
            break;
        }
      }
       if(flag!=0)
      {
        num[i]= num[i]+s+1;
        cout<<num[i]/60<<" "<<num[i]%60<<endl;
      }
       else
      {
        num[n-1] = num[n-1]+s+1;
        cout<<num[n-1]/60<<" "<<num[n-1]%60<<endl;
      }
      }

}


#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<string>
using namespace std;
int num[105];
int main()
{

    int n,s;
    int i,j;
    int h,m;
    int flag;
    cin>>n>>s;
    for(int kk=0;kk<n;kk++)
    {
        cin>>h>>m;
        num[kk] = h*60+m;
    }

    if(s+1<=num[0])
    {
        cout<<"0 0"<<endl;
    }
    else
    {
       flag=0;
       for(i=0;i<n-1;i++)
       {
        if(num[i]+2+s*2 <=num[i+1])
        {
            flag=1;
            break;
        }
      }
       if(flag!=0)
      {
        num[i]= num[i]+s+1;
        cout<<num[i]/60<<" "<<num[i]%60<<endl;
      }
       else
      {
        num[n-1] = num[n-1]+s+1;
        cout<<num[n-1]/60<<" "<<num[n-1]%60<<endl;
      }
      }

}


#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<string>
using namespace std;
int num[105];
int main()
{

    int n,s;
    int i,j;
    int h,m;
    int flag;
    cin>>n>>s;
    for(int kk=0;kk<n;kk++)
    {
        cin>>h>>m;
        num[kk] = h*60+m;
    }

    if(s+1<num[0])
    {
        cout<<"0 0"<<endl;
    }
    else
    {
       flag=0;
       for(i=1;i<n-1;i++)
       {
        if(num[i]+2+s*2 <num[i+1])
        {
            flag=1;
            break;
        }
      }
       if(flag!=0)
      {
        num[i]= num[i]+s+1;
        cout<<num[i]/60<<" "<<num[i]%60<<endl;
      }
       else
      {
        num[n-1] = num[n-1]+s+1;
        cout<<num[n-1]/60<<" "<<num[n-1]%60<<endl;
      }
      }

}


#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<string>
using namespace std;
int num[105];
int main()
{

    int n,s;
    int i,j;
    int h,m;
    int flag;
    cin>>n>>s;
    for(int kk=0;kk<n;kk++)
    {
        cin>>h>>m;
        num[kk] = h*60+m;
    }

    if(s+1<=num[0])
    {
        cout<<"0 0"<<endl;
    }
    else
    {
       flag=0;
       for(i=1;i<n-1;i++)
       {
        if(num[i]+2+s*2 <=num[i+1])
        {
            flag=1;
            break;
        }
      }
       if(flag!=0)
      {
        num[i]= num[i]+s+1;
        cout<<num[i]/60<<" "<<num[i]%60<<endl;
      }
       else
      {
        num[n-1] = num[n-1]+s+1;
        cout<<num[n-1]/60<<" "<<num[n-1]%60<<endl;
      }
      }

}


#include <iostream>

using namespace std;

int main()
{
    int n, s, a[110], x, y;
    bool found = false;

    cin >> n >> s;

    for (int i = 0; i < n; i++)
    {
        cin >> x >> y;
        a[i] = (x*60) + y;
        // cout << a[i] << endl;
    }

    if (s < a[0])
    {
        cout << "0 0" << endl;
        found = true;
    }

    int i = 0;
    int k = a[i];

    while (!found)
    {
        if (i == n-1)
            break;

        if (k == a[i+1])
        {
            i++;
        }

        if (((a[i] + s) < k) && ((k + s) < a[i+1]))
        {
            cout << k / 60 << " " << k % 60 << endl;
            found = true;
            break;
        }

        k++;
    }

    if (!found)
        cout << (a[n-1] + s + 1) / 60 << " " << (a[n-1] + s + 1) % 60 << endl;

    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
const int maxn=102;
int n,s;
int a[maxn];

int main()
{
	cin>>n>>s;
	for(int i=1;i<=n;i++)
	{
		int hh,mm;
		cin>>hh>>mm;
		mm+=hh*60;
		a[i]=mm+1;
	}
	int br=s*2+1;
	if(a[1]-1>=s+1)
	{
		printf("0 0\n");
		return 0;
	}
	for(int i=1;i<n;i++)
	{
		if(a[i+1]-a[i]-1>=br)
		{
			int h,m;
			m=a[i]+s;
			h=m/60;
			m%=60;
			cout<<h<<" "<<m<<endl;
			return 0;
		}
	}
	int h,m;
	m=a[n]+s;
	h=m/60;
	m%=60;
	cout<<h<<" "<<m<<endl;
	return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
const int maxn=102;
int n,s;
int a[maxn];

int main()
{
	cin>>n>>s;
	for(int i=1;i<=n;i++)
	{
		int hh,mm;
		cin>>hh>>mm;
		mm+=hh*60;
		a[i]=mm+1;
	}
	int br=s*2+1;
	if(a[1]>=s+1)
	{
		printf("0 0\n");
		return 0;
	}
	for(int i=1;i<n;i++)
	{
		if(a[i+1]-a[i]-1>=br)
		{
			int h,m;
			m=a[i]+s;
			h=m/60;
			m%=60;
			cout<<h<<" "<<m<<endl;
			return 0;
		}
	}
	int h,m;
	m=a[n]+s;
	h=m/60;
	m%=60;
	cout<<h<<" "<<m<<endl;
	return 0;
}


#include<cstdio>

using namespace std;

int n,s,h,m,mg,pTime;

inline int conv(int h,int m){
	return h * 60 + m;
}

void rev(int & h,int & m,int d){
	h = d / 60;
	m = d % 60;
}

int main(){
	scanf("%d%d",&n,&s);
	for(int i = 0;i <= n;i++){
		if(i == n){
			rev(h,m,pTime + s + 1);
			printf("%d %d",h,m);
			return 0;
		}
		scanf("%d%d",&h,&m);
		mg = conv(h,m);
		if(i == 0){
			if(mg > s + 2){
				puts("0 0");
				return 0;
			}
		} else if(mg - pTime > 2 * s + 3){
			rev(h,m,pTime + s + 1);
			printf("%d %d",h,m);
			return 0;
		}
		pTime = mg;
	}
	return 0;
}


#include<cstdio>

using namespace std;

int n,s,h,m,mg,pTime;

inline int conv(int h,int m){
	return h * 60 + m;
}

void rev(int & h,int & m,int d){
	h = d / 60;
	m = d % 60;
}

int main(){
	scanf("%d%d",&n,&s);
	for(int i = 0;i <= n;i++){
		if(i == n){
			rev(h,m,pTime + s + 1);
			printf("%d %d",h,m);
		}
		scanf("%d%d",&h,&m);
		mg = conv(h,m);
		if(i == 0){
			if(mg > s + 1){
				puts("0 0");
				return 0;
			}
		} else if(mg - pTime > 2 * s + 2){
			rev(h,m,pTime + s + 1);
			printf("%d %d",h,m);
			return 0;
		}
		pTime = mg;
	}
	return 0;
}


#include<cstdio>

using namespace std;

int n,s,h,m,mg,pTime;

inline int conv(int h,int m){
	return h * 60 + m;
}

void rev(int & h,int & m,int d){
	h = d / 60;
	m = d % 60;
}

int main(){
	scanf("%d%d",&n,&s);
	for(int i = 0;i <= n;i++){
		if(i == n){
			rev(h,m,pTime + s + 1);
			printf("%d %d",h,m);
		}
		scanf("%d%d",&h,&m);
		mg = conv(h,m);
		if(i == 0){
			if(mg > s + 1){
				puts("0 0");
				return 0;
			}
		} else if(mg - pTime > 2 * s + 1){
			rev(h,m,pTime + s + 1);
			printf("%d %d",h,m);
			return 0;
		}
		pTime = mg;
	}
	return 0;
}


#include<cstdio>

using namespace std;

int n,s,h,m,mg,pTime;

inline int conv(int h,int m){
	return h * 60 + m;
}

void rev(int & h,int & m,int d){
	h = d / 60;
	m = d % 60;
}

int main(){
	scanf("%d%d",&n,&s);
	for(int i = 0;i <= n;i++){
		if(i == n){
			rev(h,m,pTime + s + 1);
			printf("%d %d",h,m);
			return 0;
		}
		scanf("%d%d",&h,&m);
		mg = conv(h,m);
		if(i == 0){
			if(mg > s + 1){
				puts("0 0");
				return 0;
			}
		} else if(mg - pTime > 2 * s + 2){
			rev(h,m,pTime + s + 1);
			printf("%d %d",h,m);
			return 0;
		}
		pTime = mg;
	}
	return 0;
}


#include<bits/stdc++.h>
#include<ctype.h>
# define pb push_back
#define fst first
#define sec second
#define For(i,a,b) for(int i=a;i<b;i++)
#define ll long long int
#define ull unsigned long long int
#define mod 1000000007
#define fo(i,n) for(ll i=0;i<n;i++)
#define endl "\n"
#define rev(i,n) for(ll i=n-1;i>=0;i--)
#define fo1(i,n) for(ll i=1;i<=n;i++)
#define boolsize 1000001
#define pi pair<ll,ll>
#define vi vector<ll>
#define vii vector<pi>
using namespace std;
template<typename T>
void showvector(vector <T> v)
{
    for(T x:v)
        cout<<x<<" ";
    cout<<endl;

}
template<typename T>
void showvector1(vector <T> v)
{
    ll n=v.size();
    fo1(i,n-1)
        cout<<v[i]<<endl;

}
template<typename T>
void showset(set <T> s)
{
    for(T x: s)
        cout<<x<<" ";
    cout<<endl;
}
template<class T>
void showvectorpair(vector<T> v)
{
    for(auto it=v.begin();it!=v.end();it++)
        cout<<it->first<<" "<<it->second<<endl;
    cout<<endl;
}
template<typename T,typename P>
void showmap(map <T,P> m)
{
    for(auto it=m.begin();it!=m.end();it++)
        cout<<it->first<<" "<<it->second<<endl;
    cout<<endl;
}
template<typename T>
bool comp(T a,T b)
{
    return (a>b);
}
template<class T>
bool comppair(T a,T b)
{
    if(a.first==b.first)
        return(a.second>b.second);
    return (a.first>b.first);
}
bool sameparity(ll a,ll b)
{
    return (a%2==b%2);
}
bool difparity(ll a,ll b)
{
    return !(a%2==b%2);
}
bool isprime(ll x)
{   if(x<=1)
     return false;
    for(ll i=2;i<=sqrt(x);i++)
    {
        if(x%i==0)
            return false;
    }
    return true;
}
bool iseven(ll x)
{
    return !(x%2);
}
bool isodd(ll x)
{
    return (x%2);
}
/// check for test case before submitting
void vfun()
{
    ll n,k;
    cin>>n;
    vector <ll> v(n);
    fo(i,n)
    cin>>v[i];

}

int main()
{
//    #ifndef ONLINE_JUDGE
//    freopen("input.txt", "r", stdin);
//    freopen("outputh.txt", "w", stdout);
//    #endif
//    ios_base::sync_with_stdio(0); ///cant use scanf, printf
  //  cin.tie(0);cout.tie(0); /// no longer auto flush cout before each cin, remove for interactive
    //cout << fixed << setprecision(11); /// no scientific output
    ll test=1;
    cin>>test;
    while(test--)
    {
            ll l,r;
            cin>>l>>r;
            else
            {
                ll c=(r+1);
                if((l%c)>=c/2)
                    cout<<"YES\n";
                else
                    cout<<"NO\n";
            }

            //cout<< "hello world";
//         if(vfun())
//            cout<<"YES\n";
//         else
//            cout<<"NO\n";
    }
}
///before sub
/// check for value of zero and single input in array
///loop vars,1LL in mult, equal, one, bounds, int v ll, endl, finish taking inputs
/// check whether test cases are given or not


#include<bits/stdc++.h>
#include<ctype.h>
# define pb push_back
#define fst first
#define sec second
#define For(i,a,b) for(int i=a;i<b;i++)
#define ll long long int
#define ull unsigned long long int
#define mod 1000000007
#define fo(i,n) for(ll i=0;i<n;i++)
#define endl "\n"
#define rev(i,n) for(ll i=n-1;i>=0;i--)
#define fo1(i,n) for(ll i=1;i<=n;i++)
#define boolsize 1000001
#define pi pair<ll,ll>
#define vi vector<ll>
#define vii vector<pi>
using namespace std;
template<typename T>
void showvector(vector <T> v)
{
    for(T x:v)
        cout<<x<<" ";
    cout<<endl;

}
template<typename T>
void showvector1(vector <T> v)
{
    ll n=v.size();
    fo1(i,n-1)
        cout<<v[i]<<endl;

}
template<typename T>
void showset(set <T> s)
{
    for(T x: s)
        cout<<x<<" ";
    cout<<endl;
}
template<class T>
void showvectorpair(vector<T> v)
{
    for(auto it=v.begin();it!=v.end();it++)
        cout<<it->first<<" "<<it->second<<endl;
    cout<<endl;
}
template<typename T,typename P>
void showmap(map <T,P> m)
{
    for(auto it=m.begin();it!=m.end();it++)
        cout<<it->first<<" "<<it->second<<endl;
    cout<<endl;
}
template<typename T>
bool comp(T a,T b)
{
    return (a>b);
}
template<class T>
bool comppair(T a,T b)
{
    if(a.first==b.first)
        return(a.second>b.second);
    return (a.first>b.first);
}
bool sameparity(ll a,ll b)
{
    return (a%2==b%2);
}
bool difparity(ll a,ll b)
{
    return !(a%2==b%2);
}
bool isprime(ll x)
{   if(x<=1)
     return false;
    for(ll i=2;i<=sqrt(x);i++)
    {
        if(x%i==0)
            return false;
    }
    return true;
}
bool iseven(ll x)
{
    return !(x%2);
}
bool isodd(ll x)
{
    return (x%2);
}
/// check for test case before submitting
void vfun()
{
    ll n,k;
    cin>>n;
    vector <ll> v(n);
    fo(i,n)
    cin>>v[i];

}

int main()
{
//    #ifndef ONLINE_JUDGE
//    freopen("input.txt", "r", stdin);
//    freopen("outputh.txt", "w", stdout);
//    #endif
//    ios_base::sync_with_stdio(0); ///cant use scanf, printf
  //  cin.tie(0);cout.tie(0); /// no longer auto flush cout before each cin, remove for interactive
    //cout << fixed << setprecision(11); /// no scientific output
    ll test=1;
    cin>>test;
    while(test--)
    {
            ll l,r;
            cin>>l>>r;
            else
            {
                ll c=(r+1);
                if((l%c)>=(c/2.0))
                    cout<<"YES\n";
                else
                    cout<<"NO\n";
            }

            //cout<< "hello world";
//         if(vfun())
//            cout<<"YES\n";
//         else
//            cout<<"NO\n";
    }
}
///before sub
/// check for value of zero and single input in array
///loop vars,1LL in mult, equal, one, bounds, int v ll, endl, finish taking inputs
/// check whether test cases are given or no


#include<bits/stdc++.h>
#include<ctype.h>
# define pb push_back
#define fst first
#define sec second
#define For(i,a,b) for(int i=a;i<b;i++)
#define ll long long int
#define ull unsigned long long int
#define mod 1000000007
#define fo(i,n) for(ll i=0;i<n;i++)
#define endl "\n"
#define rev(i,n) for(ll i=n-1;i>=0;i--)
#define fo1(i,n) for(ll i=1;i<=n;i++)
#define boolsize 1000001
#define pi pair<ll,ll>
#define vi vector<ll>
#define vii vector<pi>
using namespace std;
template<typename T>
void showvector(vector <T> v)
{
    for(T x:v)
        cout<<x<<" ";
    cout<<endl;

}
template<typename T>
void showvector1(vector <T> v)
{
    ll n=v.size();
    fo1(i,n-1)
        cout<<v[i]<<endl;

}
template<typename T>
void showset(set <T> s)
{
    for(T x: s)
        cout<<x<<" ";
    cout<<endl;
}
template<class T>
void showvectorpair(vector<T> v)
{
    for(auto it=v.begin();it!=v.end();it++)
        cout<<it->first<<" "<<it->second<<endl;
    cout<<endl;
}
template<typename T,typename P>
void showmap(map <T,P> m)
{
    for(auto it=m.begin();it!=m.end();it++)
        cout<<it->first<<" "<<it->second<<endl;
    cout<<endl;
}
template<typename T>
bool comp(T a,T b)
{
    return (a>b);
}
template<class T>
bool comppair(T a,T b)
{
    if(a.first==b.first)
        return(a.second>b.second);
    return (a.first>b.first);
}
bool sameparity(ll a,ll b)
{
    return (a%2==b%2);
}
bool difparity(ll a,ll b)
{
    return !(a%2==b%2);
}
bool isprime(ll x)
{   if(x<=1)
     return false;
    for(ll i=2;i<=sqrt(x);i++)
    {
        if(x%i==0)
            return false;
    }
    return true;
}
bool iseven(ll x)
{
    return !(x%2);
}
bool isodd(ll x)
{
    return (x%2);
}
/// check for test case before submitting
void vfun()
{
    ll n,k;
    cin>>n;
    vector <ll> v(n);
    fo(i,n)
    cin>>v[i];

}

int main()
{
//    #ifndef ONLINE_JUDGE
//    freopen("input.txt", "r", stdin);
//    freopen("outputh.txt", "w", stdout);
//    #endif
//    ios_base::sync_with_stdio(0); ///cant use scanf, printf
  //  cin.tie(0);cout.tie(0); /// no longer auto flush cout before each cin, remove for interactive
    //cout << fixed << setprecision(11); /// no scientific output
    ll test=1;
    cin>>test;
    while(test--)
    {
            ll l,r;
            cin>>l>>r;
            {
                ll c=(r+1);
                if((l%c)>=c/2)
                    cout<<"YES\n";
                else
                    cout<<"NO\n";
            }

            //cout<< "hello world";
//         if(vfun())
//            cout<<"YES\n";
//         else
//            cout<<"NO\n";
    }
}
///before sub
/// check for value of zero and single input in array
///loop vars,1LL in mult, equal, one, bounds, int v ll, endl, finish taking inputs
/// check whether test cases are given or not


#include<bits/stdc++.h>
#include<ctype.h>
# define pb push_back
#define fst first
#define sec second
#define For(i,a,b) for(int i=a;i<b;i++)
#define ll long long int
#define ull unsigned long long int
#define mod 1000000007
#define fo(i,n) for(ll i=0;i<n;i++)
#define endl "\n"
#define rev(i,n) for(ll i=n-1;i>=0;i--)
#define fo1(i,n) for(ll i=1;i<=n;i++)
#define boolsize 1000001
#define pi pair<ll,ll>
#define vi vector<ll>
#define vii vector<pi>
using namespace std;
template<typename T>
void showvector(vector <T> v)
{
    for(T x:v)
        cout<<x<<" ";
    cout<<endl;

}
template<typename T>
void showvector1(vector <T> v)
{
    ll n=v.size();
    fo1(i,n-1)
        cout<<v[i]<<endl;

}
template<typename T>
void showset(set <T> s)
{
    for(T x: s)
        cout<<x<<" ";
    cout<<endl;
}
template<class T>
void showvectorpair(vector<T> v)
{
    for(auto it=v.begin();it!=v.end();it++)
        cout<<it->first<<" "<<it->second<<endl;
    cout<<endl;
}
template<typename T,typename P>
void showmap(map <T,P> m)
{
    for(auto it=m.begin();it!=m.end();it++)
        cout<<it->first<<" "<<it->second<<endl;
    cout<<endl;
}
template<typename T>
bool comp(T a,T b)
{
    return (a>b);
}
template<class T>
bool comppair(T a,T b)
{
    if(a.first==b.first)
        return(a.second>b.second);
    return (a.first>b.first);
}
bool sameparity(ll a,ll b)
{
    return (a%2==b%2);
}
bool difparity(ll a,ll b)
{
    return !(a%2==b%2);
}
bool isprime(ll x)
{   if(x<=1)
     return false;
    for(ll i=2;i<=sqrt(x);i++)
    {
        if(x%i==0)
            return false;
    }
    return true;
}
bool iseven(ll x)
{
    return !(x%2);
}
bool isodd(ll x)
{
    return (x%2);
}
/// check for test case before submitting
void vfun()
{
    ll n,k;
    cin>>n;
    vector <ll> v(n);
    fo(i,n)
    cin>>v[i];

}

int main()
{
//    #ifndef ONLINE_JUDGE
//    freopen("input.txt", "r", stdin);
//    freopen("outputh.txt", "w", stdout);
//    #endif
//    ios_base::sync_with_stdio(0); ///cant use scanf, printf
  //  cin.tie(0);cout.tie(0); /// no longer auto flush cout before each cin, remove for interactive
    //cout << fixed << setprecision(11); /// no scientific output
    ll test=1;
    cin>>test;
    while(test--)
    {
            ll l,r;
            cin>>l>>r;
            if(l==1)
                cout<<"NO\n";
            else
            {
                ll c=(r+1);
                if((l%c)>=(c/2.0))
                    cout<<"YES\n";
                else
                    cout<<"NO\n";
            }

            //cout<< "hello world";
//         if(vfun())
//            cout<<"YES\n";
//         else
//            cout<<"NO\n";
    }
}
///before sub
/// check for value of zero and single input in array
///loop vars,1LL in mult, equal, one, bounds, int v ll, endl, finish taking inputs
/// check whether test cases are given or no


#include<bits/stdc++.h>
#include<ctype.h>
# define pb push_back
#define fst first
#define sec second
#define For(i,a,b) for(int i=a;i<b;i++)
#define ll long long int
#define ull unsigned long long int
#define mod 1000000007
#define fo(i,n) for(ll i=0;i<n;i++)
#define endl "\n"
#define rev(i,n) for(ll i=n-1;i>=0;i--)
#define fo1(i,n) for(ll i=1;i<=n;i++)
#define boolsize 1000001
#define pi pair<ll,ll>
#define vi vector<ll>
#define vii vector<pi>
using namespace std;
template<typename T>
void showvector(vector <T> v)
{
    for(T x:v)
        cout<<x<<" ";
    cout<<endl;

}
template<typename T>
void showvector1(vector <T> v)
{
    ll n=v.size();
    fo1(i,n-1)
        cout<<v[i]<<endl;

}
template<typename T>
void showset(set <T> s)
{
    for(T x: s)
        cout<<x<<" ";
    cout<<endl;
}
template<class T>
void showvectorpair(vector<T> v)
{
    for(auto it=v.begin();it!=v.end();it++)
        cout<<it->first<<" "<<it->second<<endl;
    cout<<endl;
}
template<typename T,typename P>
void showmap(map <T,P> m)
{
    for(auto it=m.begin();it!=m.end();it++)
        cout<<it->first<<" "<<it->second<<endl;
    cout<<endl;
}
template<typename T>
bool comp(T a,T b)
{
    return (a>b);
}
template<class T>
bool comppair(T a,T b)
{
    if(a.first==b.first)
        return(a.second>b.second);
    return (a.first>b.first);
}
bool sameparity(ll a,ll b)
{
    return (a%2==b%2);
}
bool difparity(ll a,ll b)
{
    return !(a%2==b%2);
}
bool isprime(ll x)
{   if(x<=1)
     return false;
    for(ll i=2;i<=sqrt(x);i++)
    {
        if(x%i==0)
            return false;
    }
    return true;
}
bool iseven(ll x)
{
    return !(x%2);
}
bool isodd(ll x)
{
    return (x%2);
}
/// check for test case before submitting
void vfun()
{
    ll n,k;
    cin>>n;
    vector <ll> v(n);
    fo(i,n)
    cin>>v[i];

}

int main()
{
//    #ifndef ONLINE_JUDGE
//    freopen("input.txt", "r", stdin);
//    freopen("outputh.txt", "w", stdout);
//    #endif
//    ios_base::sync_with_stdio(0); ///cant use scanf, printf
  //  cin.tie(0);cout.tie(0); /// no longer auto flush cout before each cin, remove for interactive
    //cout << fixed << setprecision(11); /// no scientific output
    ll test=1;
    cin>>test;
    while(test--)
    {
            ll l,r;
            cin>>l>>r;
            {
                ll c=(r+1);
                if((l%c)>=(c/2.0))
                    cout<<"YES\n";
                else
                    cout<<"NO\n";
            }

            //cout<< "hello world";
//         if(vfun())
//            cout<<"YES\n";
//         else
//            cout<<"NO\n";
    }
}
///before sub
/// check for value of zero and single input in array
///loop vars,1LL in mult, equal, one, bounds, int v ll, endl, finish taking inputs
/// check whether test cases are given or no


#include <bits/stdc++.h>

using namespace std;

signed main() {
    int t;
    cin >> t;
    while (t--)
    {
        int l, r, q=1;
        cin >> l >> r;
        if((r-l) >= r/2)
            cout << "Yes";
        else
        cout << "No";
        cout <<'\n';
    }
}


#include <bits/stdc++.h>

using namespace std;

signed main() {
    int t;
    cin >> t;
    while (t--)
    {
        int l, r, q=1;
        cin >> l >> r;
        if(2*l<r)
            cout << "Yes";
        else
            cout << "No";
        cout <<'\n';
    }
}


#include <bits/stdc++.h>

using namespace std;

signed main() {
    int t;
    cin >> t;
    while (t--)
    {
        int l, r, q=1;
        cin >> l >> r;
        if((r-l) <= r/2)
            cout << "Yes";
        else
        cout << "No";
        cout <<'\n';
    }
}


#include <bits/stdc++.h>

using namespace std;

signed main() {
    int t;
    cin >> t;
    while (t--)
    {
        int l, r;
        cin >> l >> r;
        if(l!=1 &&((r%(l-1)>= (l-1)/2)) || (l>r/2)){
            cout << "Yes";
        }else
            cout << "no";
        cout << '\n';
    }
}


#include <bits/stdc++.h>

using namespace std;

signed main() {
    int t;
    cin >> t;
    while (t--)
    {
        int l, r, q=1;
        cin >> l >> r;
        for(int i = max(1,l-1); i <= r+1; i++){
            if(l%i>= i/2 && r%i>=i/2){
                cout << "Yes";
                q=0;
                break;
            }
        }
        if(q){
            cout << "No";
        }
        cout << '\n';
    }
}


#include <bits/stdc++.h>

using namespace std;

signed main() {
    int t;
    cin >> t;
    while (t--)
    {
        int l, r, q=1;
        cin >> l >> r;
        for(int i = l-1; i <= r+1; i++){
            if(l%i>= i/2 && r%i>=i/2){
                cout << "Yes";
                q=0;
                break;
            }
        }
        if(q){
            cout << "No";
        }
        cout << '\n';
    }
}


#include <bits/stdc++.h>

using namespace std;

signed main() {
    int t;
    cin >> t;
    while (t--)
    {
        int l, r, q=1;
        cin >> l >> r;
        if(l!=1 && (r-l) <= r/2)
            cout << "Yes";
        else
        cout << "No";
        cout <<'\n';
    }
}


#include <bits/stdc++.h>

using namespace std;

signed main() {
    int t;
    cin >> t;
    while (t--)
    {
        int l, r;
        cin >> l >> r;
        if((l!=1 && (r%(l-1)>= (l-1)/2)) || (l>r/2)){
            cout << "Yes";
        }else
        cout << "no";
        cout << '\n';
    }
}


#include <bits/stdc++.h>

using namespace std;

signed main() {
    int t;
    cin >> t;
    while (t--)
    {
        int l, r, q=1;
        cin >> l >> r;
        for(int i = max(2,l-1); i <= r+1; i++){
            if(l%i>= i/2 && r%i>=i/2){
                cout << "Yes";
                q=0;
                break;
            }
        }
        if(q){
            cout << "No";
        }
        cout << '\n';
    }
}


#include <bits/stdc++.h>

using namespace std;

signed main() {
    int t;
    cin >> t;
    while (t--)
    {
        int l, r, q=1;
        cin >> l >> r;
        if(2*l>r)
            cout << "Yes";
        else
        cout << "No";
        cout <<'\n';
    }
}


#include <bits/stdc++.h>

using namespace std;

signed main() {
    int t;
    cin >> t;
    while (t--)
    {
        int l, r, q=1;
        cin >> l >> r;
        if(r/2!=1 && (r-l) <= r/2)
            cout << "Yes";
        else
        cout << "No";
        cout <<'\n';
    }
}


#include <bits/stdc++.h>

using namespace std;

signed main() {
    int t;
    cin >> t;
    while (t--)
    {
        int l, r, q=1;
        cin >> l >> r;
        if((r-l) >= r/2)
            cout << "Yes";
        else
        cout << "No";
        cout <<'\n;'
    }
}


// Sky's the limit :)
#include <bits/stdc++.h>
using namespace std;
#define int long long

signed main() {
    ios_base::sync_with_stdio(0); cin.tie(0);

    int T = 1;
    cin >> T;
    while (T--) {
        int l, r;
        cin >> l >> r;

        if (r < l + (l + 1) / 2)
        	cout << "Yes\n";
        else
        	cout << "No\n";
    }

    return 0;
}


// Sky's the limit :)
#include <bits/stdc++.h>
using namespace std;
#define int long long

signed main() {
    ios_base::sync_with_stdio(0); cin.tie(0);

    // kuch bhi :)
    int T = 1;
    cin >> T;
    while (T--) {
        int l, r;
        cin >> l >> r;

        r = l + 1;
        if (l % r < (l + 1) / 2)
        	cout << "No\n";
        else
        	cout << "Yes\n";
    }

    return 0;
}


// Sky's the limit :)
#include <bits/stdc++.h>
using namespace std;
#define int long long

signed main() {
    ios_base::sync_with_stdio(0); cin.tie(0);

    int T = 1;
    cin >> T;
    while (T--) {
        int l, r;
        cin >> l >> r;

        if (l == 1 || r >= 2 * l)
        	cout << "No\n";
        else
        	cout << "Yes\n";
    }

    return 0;
}


// Sky's the limit :)
#include <bits/stdc++.h>
using namespace std;
#define int long long

signed main() {
    ios_base::sync_with_stdio(0); cin.tie(0);

    int T = 1;
    cin >> T;
    while (T--) {
        int l, r;
        cin >> l >> r;

        if (l == 1)
        	cout << "No\n";
        else
        	cout << "Yes\n";
    }

    return 0;
}


// Sky's the limit :)
#include <bits/stdc++.h>
using namespace std;
#define int long long

signed main() {
    ios_base::sync_with_stdio(0); cin.tie(0);

    int T = 1;
    cin >> T;
    while (T--) {
        int l, r;
        cin >> l >> r;

        if (r >= 2 * l)
        	cout << "No\n";
        else
        	cout << "Yes\n";
    }

    return 0;
}


// Sky's the limit :)
#include <bits/stdc++.h>
using namespace std;
#define int long long

signed main() {
    ios_base::sync_with_stdio(0); cin.tie(0);

    int T = 1;
    cin >> T;
    while (T--) {
        int l, r;
        cin >> l >> r;

        if (l == 1 || r > 2 * l)
        	cout << "No\n";
        else
        	cout << "Yes\n";
    }

    return 0;
}


// Sky's the limit :)
#include <bits/stdc++.h>
using namespace std;
#define int long long

signed main() {
    ios_base::sync_with_stdio(0); cin.tie(0);

    int T = 1;
    cin >> T;
    while (T--) {
        int l, r;
        cin >> l >> r;

        if (r < 2 * l) // FML
        	cout << "Yes\n";
        else
        	cout << "No\n";
    }

    return 0;
}


/**
 *    author:  yixxas
 *    created: 27.10.2020 22:34:18
**/
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>

using namespace std;

int main(){

    int T;
    cin >> T;
    while(T--){
        long long first,second;
        cin >> first >> second;
        if(first == second && first&1){
            cout << "YES" << endl;
            continue;
        }

        else if(first == second){
            if(first <= 2*(first%first) && 2*(first%first) < 2*first-0){
                cout << "YES" << endl;
                continue;
            }
            else{
                cout << "NO" << endl;
                continue;
            }
        }
        //if contain only odd number , sure can
        //if even leh
        //a that is chosen must be more than b-a
        //first number%a >= a/2
        //(a-first number%a) + first number < b
        //(a - first number%a) < b - first number
        // a - first number%a < 30
        // - first number%a < 30 - 120
        // - first number%a < -90
        // first number%a > 90
        // 120%80
        //
        // a - firstnumber%a + first number > second
        // -firstnumber%a > second-first - a
        // firstnumber%a < a - (second-first)
        // a/2 <= firstnumber%a < a - (second-first)
        // a <= 2*(firstnumber%a) < 2a - 2(second-first)

        //412 942
        //412
        // firstnumber%x < (b-a) - x
        // x/2 <= firstnumber%x < (b-a)-x
        // x <= 2 * firstnumber%x < 2(b-a) - 2x
        //
        //
        bool yes = false;
        for(long long i = second-first ; i < second*2 ; i++){
            if(i <= 2 * (first%i) && 2*(first%i) < 2*i-2*(second-first)){
                cout << "YES" << endl;
                yes = true;
                break;
            }
        }
        if(yes) continue;
        cout << "NO" << endl;
    }

    return 0;
}


/**
 *    author:  yixxas
 *    created: 27.10.2020 22:34:18
**/
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>

using namespace std;

int main(){

    int T;
    cin >> T;
    while(T--){
        long long first,second;
        cin >> first >> second;
        long long best = first * 2;
        if(2*(second%best)>= best){
            cout << "YES" << endl;
        }
        else{
            cout << "NO" << endl;;
        }

        //if even leh
        //a that is chosen must be more than b-a
        //first number%a >= a/2
        //(a-first number%a) + first number < b
        //(a - first number%a) < b - first number
        // a - first number%a < 30
        // - first number%a < 30 - 120
        // - first number%a < -90
        // first number%a > 90
        // 120%80
        //
        // a - firstnumber%a + first number > second
        // -firstnumber%a > second-first - a
        // firstnumber%a < a - (second-first)
        // a/2 <= firstnumber%a < a - (second-first)
        // a <= 2*(firstnumber%a) < 2a - 2(second-first)

        //412 942
        //412
        // firstnumber%x < (b-a) - x
        // x/2 <= firstnumber%x < (b-a)-x
        // x <= 2 * firstnumber%x < 2(b-a) - 2x
        //
        //
    }

    return 0;
}


/**
 *    author:  yixxas
 *    created: 27.10.2020 22:34:18
**/
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>

using namespace std;

int main(){

    int T;
    cin >> T;
    while(T--){
        long long first,second;
        cin >> first >> second;
        //if contain only odd number , sure can
        //if even leh
        //a that is chosen must be more than b-a
        //first number%a >= a/2
        //(a-first number%a) + first number < b
        //(a - first number%a) < b - first number
        // a - first number%a < 30
        // - first number%a < 30 - 120
        // - first number%a < -90
        // first number%a > 90
        // 120%80
        //
        // a - firstnumber%a + first number > second
        // -firstnumber%a > second-first - a
        // firstnumber%a < a - (second-first)
        // a/2 <= firstnumber%a < a - (second-first)
        // a <= 2*(firstnumber%a) < 2a - 2(second-first)

        //412 942
        //412
        // firstnumber%x < (b-a) - x
        // x/2 <= firstnumber%x < (b-a)-x
        // x <= 2 * firstnumber%x < 2(b-a) - 2x
        //
        //
        bool yes = false;
        for(long long i = second-first ; i < second*2 ; i++){
            if(i <= 2 * (first%i) && 2*(first%i) < 2*i-2*(second-first)){
                cout << "YES" << endl;
                yes = true;
                break;
            }
        }
        if(yes) continue;
        cout << "NO" << endl;
    }

    return 0;
}


/**
 *    author:  yixxas
 *    created: 27.10.2020 22:34:18
**/
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>

using namespace std;

int main(){

    int T;
    cin >> T;
    while(T--){
        long long a,b;
        cin >> a >> b;
        if(a == 1 || a == 2){
            cout << "NO";
        }
        else{
            cout << "YES";
        }
        cout << endl;
    }

    return 0;
}


/**
 *    author:  yixxas
 *    created: 27.10.2020 22:34:18
**/
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>

using namespace std;

int main(){

    int T;
    cin >> T;
    while(T--){
        long long first,second;
        cin >> first >> second;
        long long best = first * 2;
        if(second%best >= best/2){
            cout << "YES" << endl;
        }
        else{
            cout << "NO" << endl;;
        }

        //if even leh
        //a that is chosen must be more than b-a
        //first number%a >= a/2
        //(a-first number%a) + first number < b
        //(a - first number%a) < b - first number
        // a - first number%a < 30
        // - first number%a < 30 - 120
        // - first number%a < -90
        // first number%a > 90
        // 120%80
        //
        // a - firstnumber%a + first number > second
        // -firstnumber%a > second-first - a
        // firstnumber%a < a - (second-first)
        // a/2 <= firstnumber%a < a - (second-first)
        // a <= 2*(firstnumber%a) < 2a - 2(second-first)

        //412 942
        //412
        // firstnumber%x < (b-a) - x
        // x/2 <= firstnumber%x < (b-a)-x
        // x <= 2 * firstnumber%x < 2(b-a) - 2x
        //
        //
    }

    return 0;
}


/**
 *    author:  yixxas
 *    created: 27.10.2020 22:34:18
**/
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>

using namespace std;

int main(){

    int T;
    cin >> T;
    while(T--){
        long long first,second;
        cin >> first >> second;
        if(first == second && first&1){
            cout << "YES" << endl;
            continue;
        }

        //if even leh
        //a that is chosen must be more than b-a
        //first number%a >= a/2
        //(a-first number%a) + first number < b
        //(a - first number%a) < b - first number
        // a - first number%a < 30
        // - first number%a < 30 - 120
        // - first number%a < -90
        // first number%a > 90
        // 120%80
        //
        // a - firstnumber%a + first number > second
        // -firstnumber%a > second-first - a
        // firstnumber%a < a - (second-first)
        // a/2 <= firstnumber%a < a - (second-first)
        // a <= 2*(firstnumber%a) < 2a - 2(second-first)

        //412 942
        //412
        // firstnumber%x < (b-a) - x
        // x/2 <= firstnumber%x < (b-a)-x
        // x <= 2 * firstnumber%x < 2(b-a) - 2x
        //
        //
        bool yes = false;
        for(long long i = second-first ; i < second*2 ; i++){
            if(i == 0) continue;
            if(i <= 2 * (first%i) && 2*(first%i) < 2*i-2*(second-first)){
                cout << "YES" << endl;
                yes = true;
                break;
            }
        }
        if(yes) continue;
        cout << "NO" << endl;
    }

    return 0;
}


/**
 *    author:  yixxas
 *    created: 27.10.2020 22:34:18
**/
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>

using namespace std;

int main(){

    int T;
    cin >> T;
    while(T--){
        long long first,second;
        cin >> first >> second;
        long long best = first * 2;
        if(best > second){
            cout << "YES" << endl;
        }
        else{
            cout << "NO" << endl;
        }

        //if even leh
        //a that is chosen must be more than b-a
        //first number%a >= a/2
        //(a-first number%a) + first number < b
        //(a - first number%a) < b - first number
        // a - first number%a < 30
        // - first number%a < 30 - 120
        // - first number%a < -90
        // first number%a > 90
        // 120%80
        //
        // a - firstnumber%a + first number > second
        // -firstnumber%a > second-first - a
        // firstnumber%a < a - (second-first)
        // a/2 <= firstnumber%a < a - (second-first)
        // a <= 2*(firstnumber%a) < 2a - 2(second-first)

        //412 942
        //412
        // firstnumber%x < (b-a) - x
        // x/2 <= firstnumber%x < (b-a)-x
        // x <= 2 * firstnumber%x < 2(b-a) - 2x
        //
        //
    }

    return 0;
}


#include <iostream>

using namespace std;

int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int l,r;
        cin>>l>>r;
        if((r+1)<=2*l||3*r<4*l)
            cout<<"YES\n";
        else
            cout<<"NO\n";
    }
    return 0;
}


#include <iostream>

using namespace std;

int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int l,r;
        cin>>l>>r;
        int flag=0;
        for(int i=l+1;i<2*l&&i<r;i++)
        {
            if(r%i>=i/2)
            {
                flag=1;
                break;
            }
        }
        if(flag==1)
            cout<<"YES\n";
        else
            cout<<"NO\n";

    }
    return 0;
}


#include <iostream>

using namespace std;

int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int l,r;
        cin>>l>>r;
        if((r+1)<2*l)
            cout<<"YES\n";
        else
            cout<<"NO\n";
    }
    return 0;
}


#include <iostream>

using namespace std;

int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        long long l,r;
        cin>>l>>r;
        if(3*r<4*l)
            cout<<"YES\n";
        else
            cout<<"NO\n";
    }
    return 0;
}


#include <iostream>

using namespace std;

int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int l,r;
        cin>>l>>r;
        if((r+1)<=2*l)
            cout<<"YES\n";
        else
            cout<<"NO\n";
    }
    return 0;
}


#include <iostream>

using namespace std;

int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int l,r;
        cin>>l>>r;
        if(3*r<=4*l)
            cout<<"YES\n";
        else
            cout<<"NO\n";
    }
    return 0;
}


#include <iostream>

using namespace std;

int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int l,r;
        cin>>l>>r;
        if((r+1)<2*l||3*r<4*l)
            cout<<"YES\n";
        else
            cout<<"NO\n";
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

template <typename T>
T inverse(T a, T m) {
  T u = 0, v = 1;
  while (a != 0) {
    T t = m / a;
    m -= t * a; swap(a, m);
    u -= t * v; swap(u, v);
  }
  assert(m == 1);
  return u;
}

template <typename T>
class Modular {
 public:
  using Type = typename decay<decltype(T::value)>::type;

  constexpr Modular() : value() {}
  template <typename U>
  Modular(const U& x) {
    value = normalize(x);
  }

  template <typename U>
  static Type normalize(const U& x) {
    Type v;
    if (-mod() <= x && x < mod()) v = static_cast<Type>(x);
    else v = static_cast<Type>(x % mod());
    if (v < 0) v += mod();
    return v;
  }

  const Type& operator()() const { return value; }
  template <typename U>
  explicit operator U() const { return static_cast<U>(value); }
  constexpr static Type mod() { return T::value; }

  Modular& operator+=(const Modular& other) { if ((value += other.value) >= mod()) value -= mod(); return *this; }
  Modular& operator-=(const Modular& other) { if ((value -= other.value) < 0) value += mod(); return *this; }
  template <typename U> Modular& operator+=(const U& other) { return *this += Modular(other); }
  template <typename U> Modular& operator-=(const U& other) { return *this -= Modular(other); }
  Modular& operator++() { return *this += 1; }
  Modular& operator--() { return *this -= 1; }
  Modular operator++(int) { Modular result(*this); *this += 1; return result; }
  Modular operator--(int) { Modular result(*this); *this -= 1; return result; }
  Modular operator-() const { return Modular(-value); }

  template <typename U = T>
  typename enable_if<is_same<typename Modular<U>::Type, int>::value, Modular>::type& operator*=(const Modular& rhs) {
#ifdef _WIN32
    uint64_t x = static_cast<int64_t>(value) * static_cast<int64_t>(rhs.value);
    uint32_t xh = static_cast<uint32_t>(x >> 32), xl = static_cast<uint32_t>(x), d, m;
    asm(
      "divl %4; \n\t"
      : "=a" (d), "=d" (m)
      : "d" (xh), "a" (xl), "r" (mod())
    );
    value = m;
#else
    value = normalize(static_cast<int64_t>(value) * static_cast<int64_t>(rhs.value));
#endif
    return *this;
  }
  template <typename U = T>
  typename enable_if<is_same<typename Modular<U>::Type, int64_t>::value, Modular>::type& operator*=(const Modular& rhs) {
    int64_t q = static_cast<int64_t>(static_cast<long double>(value) * rhs.value / mod());
    value = normalize(value * rhs.value - q * mod());
    return *this;
  }
  template <typename U = T>
  typename enable_if<!is_integral<typename Modular<U>::Type>::value, Modular>::type& operator*=(const Modular& rhs) {
    value = normalize(value * rhs.value);
    return *this;
  }

  Modular& operator/=(const Modular& other) { return *this *= Modular(inverse(other.value, mod())); }

  template <typename U>
  friend const Modular<U>& abs(const Modular<U>& v) { return v; }

  template <typename U>
  friend bool operator==(const Modular<U>& lhs, const Modular<U>& rhs);

  template <typename U>
  friend bool operator<(const Modular<U>& lhs, const Modular<U>& rhs);

  template <typename U>
  friend std::istream& operator>>(std::istream& stream, Modular<U>& number);

 private:
  Type value;
};

template <typename T> bool operator==(const Modular<T>& lhs, const Modular<T>& rhs) { return lhs.value == rhs.value; }
template <typename T, typename U> bool operator==(const Modular<T>& lhs, U rhs) { return lhs == Modular<T>(rhs); }
template <typename T, typename U> bool operator==(U lhs, const Modular<T>& rhs) { return Modular<T>(lhs) == rhs; }

template <typename T> bool operator!=(const Modular<T>& lhs, const Modular<T>& rhs) { return !(lhs == rhs); }
template <typename T, typename U> bool operator!=(const Modular<T>& lhs, U rhs) { return !(lhs == rhs); }
template <typename T, typename U> bool operator!=(U lhs, const Modular<T>& rhs) { return !(lhs == rhs); }

template <typename T> bool operator<(const Modular<T>& lhs, const Modular<T>& rhs) { return lhs.value < rhs.value; }

template <typename T> Modular<T> operator+(const Modular<T>& lhs, const Modular<T>& rhs) { return Modular<T>(lhs) += rhs; }
template <typename T, typename U> Modular<T> operator+(const Modular<T>& lhs, U rhs) { return Modular<T>(lhs) += rhs; }
template <typename T, typename U> Modular<T> operator+(U lhs, const Modular<T>& rhs) { return Modular<T>(lhs) += rhs; }

template <typename T> Modular<T> operator-(const Modular<T>& lhs, const Modular<T>& rhs) { return Modular<T>(lhs) -= rhs; }
template <typename T, typename U> Modular<T> operator-(const Modular<T>& lhs, U rhs) { return Modular<T>(lhs) -= rhs; }
template <typename T, typename U> Modular<T> operator-(U lhs, const Modular<T>& rhs) { return Modular<T>(lhs) -= rhs; }

template <typename T> Modular<T> operator*(const Modular<T>& lhs, const Modular<T>& rhs) { return Modular<T>(lhs) *= rhs; }
template <typename T, typename U> Modular<T> operator*(const Modular<T>& lhs, U rhs) { return Modular<T>(lhs) *= rhs; }
template <typename T, typename U> Modular<T> operator*(U lhs, const Modular<T>& rhs) { return Modular<T>(lhs) *= rhs; }

template <typename T> Modular<T> operator/(const Modular<T>& lhs, const Modular<T>& rhs) { return Modular<T>(lhs) /= rhs; }
template <typename T, typename U> Modular<T> operator/(const Modular<T>& lhs, U rhs) { return Modular<T>(lhs) /= rhs; }
template <typename T, typename U> Modular<T> operator/(U lhs, const Modular<T>& rhs) { return Modular<T>(lhs) /= rhs; }

template<typename T, typename U>
Modular<T> power(const Modular<T>& a, const U& b) {
  assert(b >= 0);
  Modular<T> x = a, res = 1;
  U p = b;
  while (p > 0) {
    if (p & 1) res *= x;
    x *= x;
    p >>= 1;
  }
  return res;
}

template <typename T>
bool IsZero(const Modular<T>& number) {
  return number() == 0;
}

template <typename T>
string to_string(const Modular<T>& number) {
  return to_string(number());
}

template <typename T>
std::ostream& operator<<(std::ostream& stream, const Modular<T>& number) {
  return stream << number();
}

template <typename T>
std::istream& operator>>(std::istream& stream, Modular<T>& number) {
  typename common_type<typename Modular<T>::Type, int64_t>::type x;
  stream >> x;
  number.value = Modular<T>::normalize(x);
  return stream;
}

/*
using ModType = int;

struct VarMod { static ModType value; };
ModType VarMod::value;
ModType& md = VarMod::value;
using Mint = Modular<VarMod>;
*/

constexpr int md = 998244353;
using Mint = Modular<std::integral_constant<decay<decltype(md)>::type, md>>;
int main () {

  ios_base::sync_with_stdio(false);
  cin.tie(nullptr); cout.tie(nullptr);

  int T; cin >> T;
  while (T--) {
    int64_t l, r; cin >> l >> r;
    cout << (l == 1 && r >= 2 ? "NO\n": "YES\n");
  }

  return 0;
}


#include <bits/stdc++.h>
using namespace std;

template <typename T>
T inverse(T a, T m) {
  T u = 0, v = 1;
  while (a != 0) {
    T t = m / a;
    m -= t * a; swap(a, m);
    u -= t * v; swap(u, v);
  }
  assert(m == 1);
  return u;
}

template <typename T>
class Modular {
 public:
  using Type = typename decay<decltype(T::value)>::type;

  constexpr Modular() : value() {}
  template <typename U>
  Modular(const U& x) {
    value = normalize(x);
  }

  template <typename U>
  static Type normalize(const U& x) {
    Type v;
    if (-mod() <= x && x < mod()) v = static_cast<Type>(x);
    else v = static_cast<Type>(x % mod());
    if (v < 0) v += mod();
    return v;
  }

  const Type& operator()() const { return value; }
  template <typename U>
  explicit operator U() const { return static_cast<U>(value); }
  constexpr static Type mod() { return T::value; }

  Modular& operator+=(const Modular& other) { if ((value += other.value) >= mod()) value -= mod(); return *this; }
  Modular& operator-=(const Modular& other) { if ((value -= other.value) < 0) value += mod(); return *this; }
  template <typename U> Modular& operator+=(const U& other) { return *this += Modular(other); }
  template <typename U> Modular& operator-=(const U& other) { return *this -= Modular(other); }
  Modular& operator++() { return *this += 1; }
  Modular& operator--() { return *this -= 1; }
  Modular operator++(int) { Modular result(*this); *this += 1; return result; }
  Modular operator--(int) { Modular result(*this); *this -= 1; return result; }
  Modular operator-() const { return Modular(-value); }

  template <typename U = T>
  typename enable_if<is_same<typename Modular<U>::Type, int>::value, Modular>::type& operator*=(const Modular& rhs) {
#ifdef _WIN32
    uint64_t x = static_cast<int64_t>(value) * static_cast<int64_t>(rhs.value);
    uint32_t xh = static_cast<uint32_t>(x >> 32), xl = static_cast<uint32_t>(x), d, m;
    asm(
      "divl %4; \n\t"
      : "=a" (d), "=d" (m)
      : "d" (xh), "a" (xl), "r" (mod())
    );
    value = m;
#else
    value = normalize(static_cast<int64_t>(value) * static_cast<int64_t>(rhs.value));
#endif
    return *this;
  }
  template <typename U = T>
  typename enable_if<is_same<typename Modular<U>::Type, int64_t>::value, Modular>::type& operator*=(const Modular& rhs) {
    int64_t q = static_cast<int64_t>(static_cast<long double>(value) * rhs.value / mod());
    value = normalize(value * rhs.value - q * mod());
    return *this;
  }
  template <typename U = T>
  typename enable_if<!is_integral<typename Modular<U>::Type>::value, Modular>::type& operator*=(const Modular& rhs) {
    value = normalize(value * rhs.value);
    return *this;
  }

  Modular& operator/=(const Modular& other) { return *this *= Modular(inverse(other.value, mod())); }

  template <typename U>
  friend const Modular<U>& abs(const Modular<U>& v) { return v; }

  template <typename U>
  friend bool operator==(const Modular<U>& lhs, const Modular<U>& rhs);

  template <typename U>
  friend bool operator<(const Modular<U>& lhs, const Modular<U>& rhs);

  template <typename U>
  friend std::istream& operator>>(std::istream& stream, Modular<U>& number);

 private:
  Type value;
};

template <typename T> bool operator==(const Modular<T>& lhs, const Modular<T>& rhs) { return lhs.value == rhs.value; }
template <typename T, typename U> bool operator==(const Modular<T>& lhs, U rhs) { return lhs == Modular<T>(rhs); }
template <typename T, typename U> bool operator==(U lhs, const Modular<T>& rhs) { return Modular<T>(lhs) == rhs; }

template <typename T> bool operator!=(const Modular<T>& lhs, const Modular<T>& rhs) { return !(lhs == rhs); }
template <typename T, typename U> bool operator!=(const Modular<T>& lhs, U rhs) { return !(lhs == rhs); }
template <typename T, typename U> bool operator!=(U lhs, const Modular<T>& rhs) { return !(lhs == rhs); }

template <typename T> bool operator<(const Modular<T>& lhs, const Modular<T>& rhs) { return lhs.value < rhs.value; }

template <typename T> Modular<T> operator+(const Modular<T>& lhs, const Modular<T>& rhs) { return Modular<T>(lhs) += rhs; }
template <typename T, typename U> Modular<T> operator+(const Modular<T>& lhs, U rhs) { return Modular<T>(lhs) += rhs; }
template <typename T, typename U> Modular<T> operator+(U lhs, const Modular<T>& rhs) { return Modular<T>(lhs) += rhs; }

template <typename T> Modular<T> operator-(const Modular<T>& lhs, const Modular<T>& rhs) { return Modular<T>(lhs) -= rhs; }
template <typename T, typename U> Modular<T> operator-(const Modular<T>& lhs, U rhs) { return Modular<T>(lhs) -= rhs; }
template <typename T, typename U> Modular<T> operator-(U lhs, const Modular<T>& rhs) { return Modular<T>(lhs) -= rhs; }

template <typename T> Modular<T> operator*(const Modular<T>& lhs, const Modular<T>& rhs) { return Modular<T>(lhs) *= rhs; }
template <typename T, typename U> Modular<T> operator*(const Modular<T>& lhs, U rhs) { return Modular<T>(lhs) *= rhs; }
template <typename T, typename U> Modular<T> operator*(U lhs, const Modular<T>& rhs) { return Modular<T>(lhs) *= rhs; }

template <typename T> Modular<T> operator/(const Modular<T>& lhs, const Modular<T>& rhs) { return Modular<T>(lhs) /= rhs; }
template <typename T, typename U> Modular<T> operator/(const Modular<T>& lhs, U rhs) { return Modular<T>(lhs) /= rhs; }
template <typename T, typename U> Modular<T> operator/(U lhs, const Modular<T>& rhs) { return Modular<T>(lhs) /= rhs; }

template<typename T, typename U>
Modular<T> power(const Modular<T>& a, const U& b) {
  assert(b >= 0);
  Modular<T> x = a, res = 1;
  U p = b;
  while (p > 0) {
    if (p & 1) res *= x;
    x *= x;
    p >>= 1;
  }
  return res;
}

template <typename T>
bool IsZero(const Modular<T>& number) {
  return number() == 0;
}

template <typename T>
string to_string(const Modular<T>& number) {
  return to_string(number());
}

template <typename T>
std::ostream& operator<<(std::ostream& stream, const Modular<T>& number) {
  return stream << number();
}

template <typename T>
std::istream& operator>>(std::istream& stream, Modular<T>& number) {
  typename common_type<typename Modular<T>::Type, int64_t>::type x;
  stream >> x;
  number.value = Modular<T>::normalize(x);
  return stream;
}

/*
using ModType = int;

struct VarMod { static ModType value; };
ModType VarMod::value;
ModType& md = VarMod::value;
using Mint = Modular<VarMod>;
*/

constexpr int md = 998244353;
using Mint = Modular<std::integral_constant<decay<decltype(md)>::type, md>>;
int main () {

  ios_base::sync_with_stdio(false);
  cin.tie(nullptr); cout.tie(nullptr);

  int T; cin >> T;
  while (T--) {
    int64_t l, r; cin >> l >> r;
    cout << ((l == 1 && r >= 2) || (l == 2 && r >= 3) ? "NO\n": "YES\n");
  }

  return 0;
}


#include <bits/stdc++.h>
using namespace std;

template <typename T>
T inverse(T a, T m) {
  T u = 0, v = 1;
  while (a != 0) {
    T t = m / a;
    m -= t * a; swap(a, m);
    u -= t * v; swap(u, v);
  }
  assert(m == 1);
  return u;
}

template <typename T>
class Modular {
 public:
  using Type = typename decay<decltype(T::value)>::type;

  constexpr Modular() : value() {}
  template <typename U>
  Modular(const U& x) {
    value = normalize(x);
  }

  template <typename U>
  static Type normalize(const U& x) {
    Type v;
    if (-mod() <= x && x < mod()) v = static_cast<Type>(x);
    else v = static_cast<Type>(x % mod());
    if (v < 0) v += mod();
    return v;
  }

  const Type& operator()() const { return value; }
  template <typename U>
  explicit operator U() const { return static_cast<U>(value); }
  constexpr static Type mod() { return T::value; }

  Modular& operator+=(const Modular& other) { if ((value += other.value) >= mod()) value -= mod(); return *this; }
  Modular& operator-=(const Modular& other) { if ((value -= other.value) < 0) value += mod(); return *this; }
  template <typename U> Modular& operator+=(const U& other) { return *this += Modular(other); }
  template <typename U> Modular& operator-=(const U& other) { return *this -= Modular(other); }
  Modular& operator++() { return *this += 1; }
  Modular& operator--() { return *this -= 1; }
  Modular operator++(int) { Modular result(*this); *this += 1; return result; }
  Modular operator--(int) { Modular result(*this); *this -= 1; return result; }
  Modular operator-() const { return Modular(-value); }

  template <typename U = T>
  typename enable_if<is_same<typename Modular<U>::Type, int>::value, Modular>::type& operator*=(const Modular& rhs) {
#ifdef _WIN32
    uint64_t x = static_cast<int64_t>(value) * static_cast<int64_t>(rhs.value);
    uint32_t xh = static_cast<uint32_t>(x >> 32), xl = static_cast<uint32_t>(x), d, m;
    asm(
      "divl %4; \n\t"
      : "=a" (d), "=d" (m)
      : "d" (xh), "a" (xl), "r" (mod())
    );
    value = m;
#else
    value = normalize(static_cast<int64_t>(value) * static_cast<int64_t>(rhs.value));
#endif
    return *this;
  }
  template <typename U = T>
  typename enable_if<is_same<typename Modular<U>::Type, int64_t>::value, Modular>::type& operator*=(const Modular& rhs) {
    int64_t q = static_cast<int64_t>(static_cast<long double>(value) * rhs.value / mod());
    value = normalize(value * rhs.value - q * mod());
    return *this;
  }
  template <typename U = T>
  typename enable_if<!is_integral<typename Modular<U>::Type>::value, Modular>::type& operator*=(const Modular& rhs) {
    value = normalize(value * rhs.value);
    return *this;
  }

  Modular& operator/=(const Modular& other) { return *this *= Modular(inverse(other.value, mod())); }

  template <typename U>
  friend const Modular<U>& abs(const Modular<U>& v) { return v; }

  template <typename U>
  friend bool operator==(const Modular<U>& lhs, const Modular<U>& rhs);

  template <typename U>
  friend bool operator<(const Modular<U>& lhs, const Modular<U>& rhs);

  template <typename U>
  friend std::istream& operator>>(std::istream& stream, Modular<U>& number);

 private:
  Type value;
};

template <typename T> bool operator==(const Modular<T>& lhs, const Modular<T>& rhs) { return lhs.value == rhs.value; }
template <typename T, typename U> bool operator==(const Modular<T>& lhs, U rhs) { return lhs == Modular<T>(rhs); }
template <typename T, typename U> bool operator==(U lhs, const Modular<T>& rhs) { return Modular<T>(lhs) == rhs; }

template <typename T> bool operator!=(const Modular<T>& lhs, const Modular<T>& rhs) { return !(lhs == rhs); }
template <typename T, typename U> bool operator!=(const Modular<T>& lhs, U rhs) { return !(lhs == rhs); }
template <typename T, typename U> bool operator!=(U lhs, const Modular<T>& rhs) { return !(lhs == rhs); }

template <typename T> bool operator<(const Modular<T>& lhs, const Modular<T>& rhs) { return lhs.value < rhs.value; }

template <typename T> Modular<T> operator+(const Modular<T>& lhs, const Modular<T>& rhs) { return Modular<T>(lhs) += rhs; }
template <typename T, typename U> Modular<T> operator+(const Modular<T>& lhs, U rhs) { return Modular<T>(lhs) += rhs; }
template <typename T, typename U> Modular<T> operator+(U lhs, const Modular<T>& rhs) { return Modular<T>(lhs) += rhs; }

template <typename T> Modular<T> operator-(const Modular<T>& lhs, const Modular<T>& rhs) { return Modular<T>(lhs) -= rhs; }
template <typename T, typename U> Modular<T> operator-(const Modular<T>& lhs, U rhs) { return Modular<T>(lhs) -= rhs; }
template <typename T, typename U> Modular<T> operator-(U lhs, const Modular<T>& rhs) { return Modular<T>(lhs) -= rhs; }

template <typename T> Modular<T> operator*(const Modular<T>& lhs, const Modular<T>& rhs) { return Modular<T>(lhs) *= rhs; }
template <typename T, typename U> Modular<T> operator*(const Modular<T>& lhs, U rhs) { return Modular<T>(lhs) *= rhs; }
template <typename T, typename U> Modular<T> operator*(U lhs, const Modular<T>& rhs) { return Modular<T>(lhs) *= rhs; }

template <typename T> Modular<T> operator/(const Modular<T>& lhs, const Modular<T>& rhs) { return Modular<T>(lhs) /= rhs; }
template <typename T, typename U> Modular<T> operator/(const Modular<T>& lhs, U rhs) { return Modular<T>(lhs) /= rhs; }
template <typename T, typename U> Modular<T> operator/(U lhs, const Modular<T>& rhs) { return Modular<T>(lhs) /= rhs; }

template<typename T, typename U>
Modular<T> power(const Modular<T>& a, const U& b) {
  assert(b >= 0);
  Modular<T> x = a, res = 1;
  U p = b;
  while (p > 0) {
    if (p & 1) res *= x;
    x *= x;
    p >>= 1;
  }
  return res;
}

template <typename T>
bool IsZero(const Modular<T>& number) {
  return number() == 0;
}

template <typename T>
string to_string(const Modular<T>& number) {
  return to_string(number());
}

template <typename T>
std::ostream& operator<<(std::ostream& stream, const Modular<T>& number) {
  return stream << number();
}

template <typename T>
std::istream& operator>>(std::istream& stream, Modular<T>& number) {
  typename common_type<typename Modular<T>::Type, int64_t>::type x;
  stream >> x;
  number.value = Modular<T>::normalize(x);
  return stream;
}

/*
using ModType = int;

struct VarMod { static ModType value; };
ModType VarMod::value;
ModType& md = VarMod::value;
using Mint = Modular<VarMod>;
*/

constexpr int md = 998244353;
using Mint = Modular<std::integral_constant<decay<decltype(md)>::type, md>>;
int main () {

  ios_base::sync_with_stdio(false);
  cin.tie(nullptr); cout.tie(nullptr);

  int T; cin >> T;
  while (T--) {
    int64_t l, r; cin >> l >> r;
    cout << (l == 1 || r == 1 ? "NO\n": "YES\n");
  }

  return 0;
}


#include <bits/stdc++.h>
using namespace std;

template <typename T>
T inverse(T a, T m) {
  T u = 0, v = 1;
  while (a != 0) {
    T t = m / a;
    m -= t * a; swap(a, m);
    u -= t * v; swap(u, v);
  }
  assert(m == 1);
  return u;
}

template <typename T>
class Modular {
 public:
  using Type = typename decay<decltype(T::value)>::type;

  constexpr Modular() : value() {}
  template <typename U>
  Modular(const U& x) {
    value = normalize(x);
  }

  template <typename U>
  static Type normalize(const U& x) {
    Type v;
    if (-mod() <= x && x < mod()) v = static_cast<Type>(x);
    else v = static_cast<Type>(x % mod());
    if (v < 0) v += mod();
    return v;
  }

  const Type& operator()() const { return value; }
  template <typename U>
  explicit operator U() const { return static_cast<U>(value); }
  constexpr static Type mod() { return T::value; }

  Modular& operator+=(const Modular& other) { if ((value += other.value) >= mod()) value -= mod(); return *this; }
  Modular& operator-=(const Modular& other) { if ((value -= other.value) < 0) value += mod(); return *this; }
  template <typename U> Modular& operator+=(const U& other) { return *this += Modular(other); }
  template <typename U> Modular& operator-=(const U& other) { return *this -= Modular(other); }
  Modular& operator++() { return *this += 1; }
  Modular& operator--() { return *this -= 1; }
  Modular operator++(int) { Modular result(*this); *this += 1; return result; }
  Modular operator--(int) { Modular result(*this); *this -= 1; return result; }
  Modular operator-() const { return Modular(-value); }

  template <typename U = T>
  typename enable_if<is_same<typename Modular<U>::Type, int>::value, Modular>::type& operator*=(const Modular& rhs) {
#ifdef _WIN32
    uint64_t x = static_cast<int64_t>(value) * static_cast<int64_t>(rhs.value);
    uint32_t xh = static_cast<uint32_t>(x >> 32), xl = static_cast<uint32_t>(x), d, m;
    asm(
      "divl %4; \n\t"
      : "=a" (d), "=d" (m)
      : "d" (xh), "a" (xl), "r" (mod())
    );
    value = m;
#else
    value = normalize(static_cast<int64_t>(value) * static_cast<int64_t>(rhs.value));
#endif
    return *this;
  }
  template <typename U = T>
  typename enable_if<is_same<typename Modular<U>::Type, int64_t>::value, Modular>::type& operator*=(const Modular& rhs) {
    int64_t q = static_cast<int64_t>(static_cast<long double>(value) * rhs.value / mod());
    value = normalize(value * rhs.value - q * mod());
    return *this;
  }
  template <typename U = T>
  typename enable_if<!is_integral<typename Modular<U>::Type>::value, Modular>::type& operator*=(const Modular& rhs) {
    value = normalize(value * rhs.value);
    return *this;
  }

  Modular& operator/=(const Modular& other) { return *this *= Modular(inverse(other.value, mod())); }

  template <typename U>
  friend const Modular<U>& abs(const Modular<U>& v) { return v; }

  template <typename U>
  friend bool operator==(const Modular<U>& lhs, const Modular<U>& rhs);

  template <typename U>
  friend bool operator<(const Modular<U>& lhs, const Modular<U>& rhs);

  template <typename U>
  friend std::istream& operator>>(std::istream& stream, Modular<U>& number);

 private:
  Type value;
};

template <typename T> bool operator==(const Modular<T>& lhs, const Modular<T>& rhs) { return lhs.value == rhs.value; }
template <typename T, typename U> bool operator==(const Modular<T>& lhs, U rhs) { return lhs == Modular<T>(rhs); }
template <typename T, typename U> bool operator==(U lhs, const Modular<T>& rhs) { return Modular<T>(lhs) == rhs; }

template <typename T> bool operator!=(const Modular<T>& lhs, const Modular<T>& rhs) { return !(lhs == rhs); }
template <typename T, typename U> bool operator!=(const Modular<T>& lhs, U rhs) { return !(lhs == rhs); }
template <typename T, typename U> bool operator!=(U lhs, const Modular<T>& rhs) { return !(lhs == rhs); }

template <typename T> bool operator<(const Modular<T>& lhs, const Modular<T>& rhs) { return lhs.value < rhs.value; }

template <typename T> Modular<T> operator+(const Modular<T>& lhs, const Modular<T>& rhs) { return Modular<T>(lhs) += rhs; }
template <typename T, typename U> Modular<T> operator+(const Modular<T>& lhs, U rhs) { return Modular<T>(lhs) += rhs; }
template <typename T, typename U> Modular<T> operator+(U lhs, const Modular<T>& rhs) { return Modular<T>(lhs) += rhs; }

template <typename T> Modular<T> operator-(const Modular<T>& lhs, const Modular<T>& rhs) { return Modular<T>(lhs) -= rhs; }
template <typename T, typename U> Modular<T> operator-(const Modular<T>& lhs, U rhs) { return Modular<T>(lhs) -= rhs; }
template <typename T, typename U> Modular<T> operator-(U lhs, const Modular<T>& rhs) { return Modular<T>(lhs) -= rhs; }

template <typename T> Modular<T> operator*(const Modular<T>& lhs, const Modular<T>& rhs) { return Modular<T>(lhs) *= rhs; }
template <typename T, typename U> Modular<T> operator*(const Modular<T>& lhs, U rhs) { return Modular<T>(lhs) *= rhs; }
template <typename T, typename U> Modular<T> operator*(U lhs, const Modular<T>& rhs) { return Modular<T>(lhs) *= rhs; }

template <typename T> Modular<T> operator/(const Modular<T>& lhs, const Modular<T>& rhs) { return Modular<T>(lhs) /= rhs; }
template <typename T, typename U> Modular<T> operator/(const Modular<T>& lhs, U rhs) { return Modular<T>(lhs) /= rhs; }
template <typename T, typename U> Modular<T> operator/(U lhs, const Modular<T>& rhs) { return Modular<T>(lhs) /= rhs; }

template<typename T, typename U>
Modular<T> power(const Modular<T>& a, const U& b) {
  assert(b >= 0);
  Modular<T> x = a, res = 1;
  U p = b;
  while (p > 0) {
    if (p & 1) res *= x;
    x *= x;
    p >>= 1;
  }
  return res;
}

template <typename T>
bool IsZero(const Modular<T>& number) {
  return number() == 0;
}

template <typename T>
string to_string(const Modular<T>& number) {
  return to_string(number());
}

template <typename T>
std::ostream& operator<<(std::ostream& stream, const Modular<T>& number) {
  return stream << number();
}

template <typename T>
std::istream& operator>>(std::istream& stream, Modular<T>& number) {
  typename common_type<typename Modular<T>::Type, int64_t>::type x;
  stream >> x;
  number.value = Modular<T>::normalize(x);
  return stream;
}

/*
using ModType = int;

struct VarMod { static ModType value; };
ModType VarMod::value;
ModType& md = VarMod::value;
using Mint = Modular<VarMod>;
*/

constexpr int md = 998244353;
using Mint = Modular<std::integral_constant<decay<decltype(md)>::type, md>>;
int main () {

  ios_base::sync_with_stdio(false);
  cin.tie(nullptr); cout.tie(nullptr);

  int T; cin >> T;
  while (T--) {
    int64_t l, r; cin >> l >> r;
    cout << (l == 1 && r >= 2) || (l == 2 && r >= 3) ? "NO\n": "YES\n");
  }

  return 0;
}


#include <bits/stdc++.h>
using namespace std;

template <typename T>
T inverse(T a, T m) {
  T u = 0, v = 1;
  while (a != 0) {
    T t = m / a;
    m -= t * a; swap(a, m);
    u -= t * v; swap(u, v);
  }
  assert(m == 1);
  return u;
}

template <typename T>
class Modular {
 public:
  using Type = typename decay<decltype(T::value)>::type;

  constexpr Modular() : value() {}
  template <typename U>
  Modular(const U& x) {
    value = normalize(x);
  }

  template <typename U>
  static Type normalize(const U& x) {
    Type v;
    if (-mod() <= x && x < mod()) v = static_cast<Type>(x);
    else v = static_cast<Type>(x % mod());
    if (v < 0) v += mod();
    return v;
  }

  const Type& operator()() const { return value; }
  template <typename U>
  explicit operator U() const { return static_cast<U>(value); }
  constexpr static Type mod() { return T::value; }

  Modular& operator+=(const Modular& other) { if ((value += other.value) >= mod()) value -= mod(); return *this; }
  Modular& operator-=(const Modular& other) { if ((value -= other.value) < 0) value += mod(); return *this; }
  template <typename U> Modular& operator+=(const U& other) { return *this += Modular(other); }
  template <typename U> Modular& operator-=(const U& other) { return *this -= Modular(other); }
  Modular& operator++() { return *this += 1; }
  Modular& operator--() { return *this -= 1; }
  Modular operator++(int) { Modular result(*this); *this += 1; return result; }
  Modular operator--(int) { Modular result(*this); *this -= 1; return result; }
  Modular operator-() const { return Modular(-value); }

  template <typename U = T>
  typename enable_if<is_same<typename Modular<U>::Type, int>::value, Modular>::type& operator*=(const Modular& rhs) {
#ifdef _WIN32
    uint64_t x = static_cast<int64_t>(value) * static_cast<int64_t>(rhs.value);
    uint32_t xh = static_cast<uint32_t>(x >> 32), xl = static_cast<uint32_t>(x), d, m;
    asm(
      "divl %4; \n\t"
      : "=a" (d), "=d" (m)
      : "d" (xh), "a" (xl), "r" (mod())
    );
    value = m;
#else
    value = normalize(static_cast<int64_t>(value) * static_cast<int64_t>(rhs.value));
#endif
    return *this;
  }
  template <typename U = T>
  typename enable_if<is_same<typename Modular<U>::Type, int64_t>::value, Modular>::type& operator*=(const Modular& rhs) {
    int64_t q = static_cast<int64_t>(static_cast<long double>(value) * rhs.value / mod());
    value = normalize(value * rhs.value - q * mod());
    return *this;
  }
  template <typename U = T>
  typename enable_if<!is_integral<typename Modular<U>::Type>::value, Modular>::type& operator*=(const Modular& rhs) {
    value = normalize(value * rhs.value);
    return *this;
  }

  Modular& operator/=(const Modular& other) { return *this *= Modular(inverse(other.value, mod())); }

  template <typename U>
  friend const Modular<U>& abs(const Modular<U>& v) { return v; }

  template <typename U>
  friend bool operator==(const Modular<U>& lhs, const Modular<U>& rhs);

  template <typename U>
  friend bool operator<(const Modular<U>& lhs, const Modular<U>& rhs);

  template <typename U>
  friend std::istream& operator>>(std::istream& stream, Modular<U>& number);

 private:
  Type value;
};

template <typename T> bool operator==(const Modular<T>& lhs, const Modular<T>& rhs) { return lhs.value == rhs.value; }
template <typename T, typename U> bool operator==(const Modular<T>& lhs, U rhs) { return lhs == Modular<T>(rhs); }
template <typename T, typename U> bool operator==(U lhs, const Modular<T>& rhs) { return Modular<T>(lhs) == rhs; }

template <typename T> bool operator!=(const Modular<T>& lhs, const Modular<T>& rhs) { return !(lhs == rhs); }
template <typename T, typename U> bool operator!=(const Modular<T>& lhs, U rhs) { return !(lhs == rhs); }
template <typename T, typename U> bool operator!=(U lhs, const Modular<T>& rhs) { return !(lhs == rhs); }

template <typename T> bool operator<(const Modular<T>& lhs, const Modular<T>& rhs) { return lhs.value < rhs.value; }

template <typename T> Modular<T> operator+(const Modular<T>& lhs, const Modular<T>& rhs) { return Modular<T>(lhs) += rhs; }
template <typename T, typename U> Modular<T> operator+(const Modular<T>& lhs, U rhs) { return Modular<T>(lhs) += rhs; }
template <typename T, typename U> Modular<T> operator+(U lhs, const Modular<T>& rhs) { return Modular<T>(lhs) += rhs; }

template <typename T> Modular<T> operator-(const Modular<T>& lhs, const Modular<T>& rhs) { return Modular<T>(lhs) -= rhs; }
template <typename T, typename U> Modular<T> operator-(const Modular<T>& lhs, U rhs) { return Modular<T>(lhs) -= rhs; }
template <typename T, typename U> Modular<T> operator-(U lhs, const Modular<T>& rhs) { return Modular<T>(lhs) -= rhs; }

template <typename T> Modular<T> operator*(const Modular<T>& lhs, const Modular<T>& rhs) { return Modular<T>(lhs) *= rhs; }
template <typename T, typename U> Modular<T> operator*(const Modular<T>& lhs, U rhs) { return Modular<T>(lhs) *= rhs; }
template <typename T, typename U> Modular<T> operator*(U lhs, const Modular<T>& rhs) { return Modular<T>(lhs) *= rhs; }

template <typename T> Modular<T> operator/(const Modular<T>& lhs, const Modular<T>& rhs) { return Modular<T>(lhs) /= rhs; }
template <typename T, typename U> Modular<T> operator/(const Modular<T>& lhs, U rhs) { return Modular<T>(lhs) /= rhs; }
template <typename T, typename U> Modular<T> operator/(U lhs, const Modular<T>& rhs) { return Modular<T>(lhs) /= rhs; }

template<typename T, typename U>
Modular<T> power(const Modular<T>& a, const U& b) {
  assert(b >= 0);
  Modular<T> x = a, res = 1;
  U p = b;
  while (p > 0) {
    if (p & 1) res *= x;
    x *= x;
    p >>= 1;
  }
  return res;
}

template <typename T>
bool IsZero(const Modular<T>& number) {
  return number() == 0;
}

template <typename T>
string to_string(const Modular<T>& number) {
  return to_string(number());
}

template <typename T>
std::ostream& operator<<(std::ostream& stream, const Modular<T>& number) {
  return stream << number();
}

template <typename T>
std::istream& operator>>(std::istream& stream, Modular<T>& number) {
  typename common_type<typename Modular<T>::Type, int64_t>::type x;
  stream >> x;
  number.value = Modular<T>::normalize(x);
  return stream;
}

/*
using ModType = int;

struct VarMod { static ModType value; };
ModType VarMod::value;
ModType& md = VarMod::value;
using Mint = Modular<VarMod>;
*/

constexpr int md = 998244353;
using Mint = Modular<std::integral_constant<decay<decltype(md)>::type, md>>;
int main () {

  ios_base::sync_with_stdio(false);
  cin.tie(nullptr); cout.tie(nullptr);

  int T; cin >> T;
  while (T--) {
    int64_t l, r; cin >> l >> r;
    cout << (2*l <= r ? "NO\n": "YES\n");
  }
  return 0;
}


#include <bits/stdc++.h>
using namespace std;

template <typename T>
T inverse(T a, T m) {
  T u = 0, v = 1;
  while (a != 0) {
    T t = m / a;
    m -= t * a; swap(a, m);
    u -= t * v; swap(u, v);
  }
  assert(m == 1);
  return u;
}

template <typename T>
class Modular {
 public:
  using Type = typename decay<decltype(T::value)>::type;

  constexpr Modular() : value() {}
  template <typename U>
  Modular(const U& x) {
    value = normalize(x);
  }

  template <typename U>
  static Type normalize(const U& x) {
    Type v;
    if (-mod() <= x && x < mod()) v = static_cast<Type>(x);
    else v = static_cast<Type>(x % mod());
    if (v < 0) v += mod();
    return v;
  }

  const Type& operator()() const { return value; }
  template <typename U>
  explicit operator U() const { return static_cast<U>(value); }
  constexpr static Type mod() { return T::value; }

  Modular& operator+=(const Modular& other) { if ((value += other.value) >= mod()) value -= mod(); return *this; }
  Modular& operator-=(const Modular& other) { if ((value -= other.value) < 0) value += mod(); return *this; }
  template <typename U> Modular& operator+=(const U& other) { return *this += Modular(other); }
  template <typename U> Modular& operator-=(const U& other) { return *this -= Modular(other); }
  Modular& operator++() { return *this += 1; }
  Modular& operator--() { return *this -= 1; }
  Modular operator++(int) { Modular result(*this); *this += 1; return result; }
  Modular operator--(int) { Modular result(*this); *this -= 1; return result; }
  Modular operator-() const { return Modular(-value); }

  template <typename U = T>
  typename enable_if<is_same<typename Modular<U>::Type, int>::value, Modular>::type& operator*=(const Modular& rhs) {
#ifdef _WIN32
    uint64_t x = static_cast<int64_t>(value) * static_cast<int64_t>(rhs.value);
    uint32_t xh = static_cast<uint32_t>(x >> 32), xl = static_cast<uint32_t>(x), d, m;
    asm(
      "divl %4; \n\t"
      : "=a" (d), "=d" (m)
      : "d" (xh), "a" (xl), "r" (mod())
    );
    value = m;
#else
    value = normalize(static_cast<int64_t>(value) * static_cast<int64_t>(rhs.value));
#endif
    return *this;
  }
  template <typename U = T>
  typename enable_if<is_same<typename Modular<U>::Type, int64_t>::value, Modular>::type& operator*=(const Modular& rhs) {
    int64_t q = static_cast<int64_t>(static_cast<long double>(value) * rhs.value / mod());
    value = normalize(value * rhs.value - q * mod());
    return *this;
  }
  template <typename U = T>
  typename enable_if<!is_integral<typename Modular<U>::Type>::value, Modular>::type& operator*=(const Modular& rhs) {
    value = normalize(value * rhs.value);
    return *this;
  }

  Modular& operator/=(const Modular& other) { return *this *= Modular(inverse(other.value, mod())); }

  template <typename U>
  friend const Modular<U>& abs(const Modular<U>& v) { return v; }

  template <typename U>
  friend bool operator==(const Modular<U>& lhs, const Modular<U>& rhs);

  template <typename U>
  friend bool operator<(const Modular<U>& lhs, const Modular<U>& rhs);

  template <typename U>
  friend std::istream& operator>>(std::istream& stream, Modular<U>& number);

 private:
  Type value;
};

template <typename T> bool operator==(const Modular<T>& lhs, const Modular<T>& rhs) { return lhs.value == rhs.value; }
template <typename T, typename U> bool operator==(const Modular<T>& lhs, U rhs) { return lhs == Modular<T>(rhs); }
template <typename T, typename U> bool operator==(U lhs, const Modular<T>& rhs) { return Modular<T>(lhs) == rhs; }

template <typename T> bool operator!=(const Modular<T>& lhs, const Modular<T>& rhs) { return !(lhs == rhs); }
template <typename T, typename U> bool operator!=(const Modular<T>& lhs, U rhs) { return !(lhs == rhs); }
template <typename T, typename U> bool operator!=(U lhs, const Modular<T>& rhs) { return !(lhs == rhs); }

template <typename T> bool operator<(const Modular<T>& lhs, const Modular<T>& rhs) { return lhs.value < rhs.value; }

template <typename T> Modular<T> operator+(const Modular<T>& lhs, const Modular<T>& rhs) { return Modular<T>(lhs) += rhs; }
template <typename T, typename U> Modular<T> operator+(const Modular<T>& lhs, U rhs) { return Modular<T>(lhs) += rhs; }
template <typename T, typename U> Modular<T> operator+(U lhs, const Modular<T>& rhs) { return Modular<T>(lhs) += rhs; }

template <typename T> Modular<T> operator-(const Modular<T>& lhs, const Modular<T>& rhs) { return Modular<T>(lhs) -= rhs; }
template <typename T, typename U> Modular<T> operator-(const Modular<T>& lhs, U rhs) { return Modular<T>(lhs) -= rhs; }
template <typename T, typename U> Modular<T> operator-(U lhs, const Modular<T>& rhs) { return Modular<T>(lhs) -= rhs; }

template <typename T> Modular<T> operator*(const Modular<T>& lhs, const Modular<T>& rhs) { return Modular<T>(lhs) *= rhs; }
template <typename T, typename U> Modular<T> operator*(const Modular<T>& lhs, U rhs) { return Modular<T>(lhs) *= rhs; }
template <typename T, typename U> Modular<T> operator*(U lhs, const Modular<T>& rhs) { return Modular<T>(lhs) *= rhs; }

template <typename T> Modular<T> operator/(const Modular<T>& lhs, const Modular<T>& rhs) { return Modular<T>(lhs) /= rhs; }
template <typename T, typename U> Modular<T> operator/(const Modular<T>& lhs, U rhs) { return Modular<T>(lhs) /= rhs; }
template <typename T, typename U> Modular<T> operator/(U lhs, const Modular<T>& rhs) { return Modular<T>(lhs) /= rhs; }

template<typename T, typename U>
Modular<T> power(const Modular<T>& a, const U& b) {
  assert(b >= 0);
  Modular<T> x = a, res = 1;
  U p = b;
  while (p > 0) {
    if (p & 1) res *= x;
    x *= x;
    p >>= 1;
  }
  return res;
}

template <typename T>
bool IsZero(const Modular<T>& number) {
  return number() == 0;
}

template <typename T>
string to_string(const Modular<T>& number) {
  return to_string(number());
}

template <typename T>
std::ostream& operator<<(std::ostream& stream, const Modular<T>& number) {
  return stream << number();
}

template <typename T>
std::istream& operator>>(std::istream& stream, Modular<T>& number) {
  typename common_type<typename Modular<T>::Type, int64_t>::type x;
  stream >> x;
  number.value = Modular<T>::normalize(x);
  return stream;
}

/*
using ModType = int;

struct VarMod { static ModType value; };
ModType VarMod::value;
ModType& md = VarMod::value;
using Mint = Modular<VarMod>;
*/

constexpr int md = 998244353;
using Mint = Modular<std::integral_constant<decay<decltype(md)>::type, md>>;
int main () {

  ios_base::sync_with_stdio(false);
  cin.tie(nullptr); cout.tie(nullptr);

  int T; cin >> T;
  while (T--) {
    int64_t l, r; cin >> l >> r;
    cout << (l <= 2 || r <= 2 ? "NO\n": "YES\n");
  }

  return 0;
}