#include<bits/stdc++.h>
using namespace std;
int main()
{
int t, n, x, h=0;
int c[1005];
cin>>t;
for(int i=1;i<=t;i++)
{
cin>>n>>x;
n-=2;
h=n/3;
if(n%3==0)
{
h+=1;
}
else
{
h+=2;
}
c[i]=h;
h=0;
n=0;
x=0;
}
for(int i=1;i<=t;i++)
{
if(i<=t-1)
{
cout<<c[i]<<endl;
}
else
{
cout<<c[i];
}
}
return 0;
}