#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
#define M 1000000007
#define INF 1000000007
typedef pair<lli,lli> ll;
#define mem(a,x) memset(a,x,sizeof(a))
lli n,k,m;
lli vis[10007];
lli dist[507][507];
lli path[207][207];
lli path1[207][207];
vector<int> v2(1005,1);
vector<vector<lli>> v;
lli x,y,c,z;
map<int,int> m1;
struct edge
{
lli a,b,cost;
};
/*void djkstra(int x,vector<ll> v[])
{
mem(vis,0);
dist[x]=0;
s2.insert({0,x});
while(!s2.empty())
{
ll p=*s2.begin();
s2.erase(s2.begin());
x=p.second;
if(vis[x])
continue;
vis[x]=1;
for(int j=0;j<v[x].size();j++)
{
if(dist[v[x][j].second]>dist[x]+v[x][j].first)
{
dist[v[x][j].second]=dist[x]+v[x][j].first;
s2.insert({dist[v[x][j].second],v[x][j].second});
a[v[x][j].second]=x;
}
}
}
}*/
lli parent[100007];
lli find(lli a)
{
return a==parent[a]?a:parent[a]=find(parent[a]);
}
void dset(lli n)
{
for(int j=0;j<=n;j++)
parent[j]=j;
}
void unio(lli a,lli b,lli rank[])
{
if(rank[find(a)]>rank[find(b)])
parent[find(b)]=find(a);
else if(rank[find(b)]>rank[find(a)])
parent[find(a)]=find(b);
else
{
parent[find(a)]=find(b);
rank[find(b)]++;
}
}
bool check(lli a,lli b)
{
return find(a)==find(b);
}
lli vis1[31];
lli q,u,v1,l,t;
lli a[300007];
/*bool valid(int i,int x)
{
for(int j=1;j<x;j++)
{
if((abs(b[j-1]-i)==abs(j-x))||(i==b[j-1])||(j==x))
return false;
}
return true;
}*/
lli d,N,e;
lli tot;
lli m4=0;
struct edge coins[41];
lli dp[1001][1001];
int f=0;
lli dp1[100000];
lli solve(lli x,lli y,lli e,lli w)
{
if(dp[x][y]!=100000)
{
return dp[x][y];
}
if((x*x+y*y)==e*e)
{
return 0;
}
for(int i=1;i<=N;i++)
{
if(((x+coins[i].a)*(x+coins[i].a)+(y+coins[i].b)*(y+coins[i].b))<=e*e)
{
dp[x][y]=min(dp[x][y],(solve(x+coins[i].a,y+coins[i].b,e,i)+1));
}
}
return dp[x][y];
}
int main()
{
cin>>n;
for(int i=1;i<=n;i++)
{
f=0;
for(int j=0;j<1001;j++)
{
for(int k=0;k<1001;k++)
dp[j][k]=100000;
}
for(int i=0;i<100000;i++)
dp1[i]=100000;
cin>>N>>e;
for(int j=1;j<=N;j++)
{
cin>>x>>y;
coins[j].a=x;
coins[j].b=y;
}
lli d=solve(0,0,e,0);
if(d==100000)
cout<<"not possible"<<endl;
else
cout<<d<<endl;
}
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKdHlwZWRlZiBsb25nIGxvbmcgaW50IGxsaTsKI2RlZmluZSBNIDEwMDAwMDAwMDcKI2RlZmluZSBJTkYgMTAwMDAwMDAwNwp0eXBlZGVmIHBhaXI8bGxpLGxsaT4gbGw7CiNkZWZpbmUgbWVtKGEseCkgbWVtc2V0KGEseCxzaXplb2YoYSkpCmxsaSBuLGssbTsKbGxpIHZpc1sxMDAwN107CmxsaSBkaXN0WzUwN11bNTA3XTsKbGxpIHBhdGhbMjA3XVsyMDddOwpsbGkgcGF0aDFbMjA3XVsyMDddOwp2ZWN0b3I8aW50PiB2MigxMDA1LDEpOwp2ZWN0b3I8dmVjdG9yPGxsaT4+IHY7CmxsaSB4LHksYyx6OwptYXA8aW50LGludD4gbTE7CnN0cnVjdCBlZGdlCnsKICAgIGxsaSBhLGIsY29zdDsKfTsKLyp2b2lkIGRqa3N0cmEoaW50IHgsdmVjdG9yPGxsPiB2W10pCnsKICAgIG1lbSh2aXMsMCk7CiAgICBkaXN0W3hdPTA7CiAgICBzMi5pbnNlcnQoezAseH0pOwogICAgd2hpbGUoIXMyLmVtcHR5KCkpCiAgICB7CiAgICAgICAgbGwgcD0qczIuYmVnaW4oKTsKICAgICAgICBzMi5lcmFzZShzMi5iZWdpbigpKTsKICAgICAgICB4PXAuc2Vjb25kOwogICAgICAgIGlmKHZpc1t4XSkKICAgICAgICBjb250aW51ZTsKICAgICAgICB2aXNbeF09MTsKICAgICAgICBmb3IoaW50IGo9MDtqPHZbeF0uc2l6ZSgpO2orKykKICAgICAgICB7CiAgICAgICAgICAgIGlmKGRpc3Rbdlt4XVtqXS5zZWNvbmRdPmRpc3RbeF0rdlt4XVtqXS5maXJzdCkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgZGlzdFt2W3hdW2pdLnNlY29uZF09ZGlzdFt4XSt2W3hdW2pdLmZpcnN0OwogICAgICAgICAgICAgICAgczIuaW5zZXJ0KHtkaXN0W3ZbeF1bal0uc2Vjb25kXSx2W3hdW2pdLnNlY29uZH0pOwogICAgICAgICAgICAgICAgYVt2W3hdW2pdLnNlY29uZF09eDsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgIH0KfSovCmxsaSBwYXJlbnRbMTAwMDA3XTsKbGxpIGZpbmQobGxpIGEpCnsKICAgIHJldHVybiBhPT1wYXJlbnRbYV0/YTpwYXJlbnRbYV09ZmluZChwYXJlbnRbYV0pOwp9CnZvaWQgZHNldChsbGkgbikKewogICAgZm9yKGludCBqPTA7ajw9bjtqKyspCiAgICBwYXJlbnRbal09ajsKfQp2b2lkIHVuaW8obGxpIGEsbGxpIGIsbGxpIHJhbmtbXSkKewogICAgaWYocmFua1tmaW5kKGEpXT5yYW5rW2ZpbmQoYildKQogICAgcGFyZW50W2ZpbmQoYildPWZpbmQoYSk7CiAgICBlbHNlIGlmKHJhbmtbZmluZChiKV0+cmFua1tmaW5kKGEpXSkKICAgIHBhcmVudFtmaW5kKGEpXT1maW5kKGIpOwogICAgZWxzZQogICAgewogICAgICAgIHBhcmVudFtmaW5kKGEpXT1maW5kKGIpOwogICAgICAgIHJhbmtbZmluZChiKV0rKzsKICAgIH0KfQpib29sIGNoZWNrKGxsaSBhLGxsaSBiKQp7CiAgICByZXR1cm4gZmluZChhKT09ZmluZChiKTsKfQpsbGkgdmlzMVszMV07CmxsaSBxLHUsdjEsbCx0OwpsbGkgYVszMDAwMDddOwovKmJvb2wgdmFsaWQoaW50IGksaW50IHgpCnsKICAgIGZvcihpbnQgaj0xO2o8eDtqKyspCiAgICB7CiAgICAgICAgaWYoKGFicyhiW2otMV0taSk9PWFicyhqLXgpKXx8KGk9PWJbai0xXSl8fChqPT14KSkKICAgICAgICByZXR1cm4gZmFsc2U7CiAgICB9CiAgICByZXR1cm4gdHJ1ZTsKfSovCmxsaSBkLE4sZTsKbGxpIHRvdDsKbGxpIG00PTA7CnN0cnVjdCBlZGdlIGNvaW5zWzQxXTsKbGxpIGRwWzEwMDFdWzEwMDFdOwppbnQgZj0wOwpsbGkgZHAxWzEwMDAwMF07CmxsaSBzb2x2ZShsbGkgeCxsbGkgeSxsbGkgZSxsbGkgdykKewogICAgaWYoZHBbeF1beV0hPTEwMDAwMCkKICAgIHsKICAgICAgICAKICAgICAgICByZXR1cm4gZHBbeF1beV07CiAgICB9CiAgICBpZigoeCp4K3kqeSk9PWUqZSkKICAgIHsKICAgICByZXR1cm4gMDsgICAKICAgIH0KICAgIGZvcihpbnQgaT0xO2k8PU47aSsrKQogICAgewogICAgICAgIGlmKCgoeCtjb2luc1tpXS5hKSooeCtjb2luc1tpXS5hKSsoeStjb2luc1tpXS5iKSooeStjb2luc1tpXS5iKSk8PWUqZSkKICAgICAgICB7CiAgICAgICAgICAgIGRwW3hdW3ldPW1pbihkcFt4XVt5XSwoc29sdmUoeCtjb2luc1tpXS5hLHkrY29pbnNbaV0uYixlLGkpKzEpKTsKICAgICAgICB9CiAgICB9CiAgICByZXR1cm4gZHBbeF1beV07Cn0KaW50IG1haW4oKQp7CmNpbj4+bjsKZm9yKGludCBpPTE7aTw9bjtpKyspCnsKICAgIGY9MDsKICAgIGZvcihpbnQgaj0wO2o8MTAwMTtqKyspCiAgICB7CiAgICAgICAgZm9yKGludCBrPTA7azwxMDAxO2srKykKICAgICAgICBkcFtqXVtrXT0xMDAwMDA7CiAgICB9CiAgICBmb3IoaW50IGk9MDtpPDEwMDAwMDtpKyspCiAgICBkcDFbaV09MTAwMDAwOwogICAgY2luPj5OPj5lOwogICAgZm9yKGludCBqPTE7ajw9TjtqKyspCiAgICB7CiAgICAgICAgY2luPj54Pj55OwogICAgICAgIGNvaW5zW2pdLmE9eDsKICAgICAgICBjb2luc1tqXS5iPXk7CiAgICB9CiAgICBsbGkgZD1zb2x2ZSgwLDAsZSwwKTsKICAgIGlmKGQ9PTEwMDAwMCkKICAgIGNvdXQ8PCJub3QgcG9zc2libGUiPDxlbmRsOwogICAgZWxzZQogICAgY291dDw8ZDw8ZW5kbDsKfQp9