#include using namespace std; #define rep(i,n) for (long long i=0;i<(long long)(n);i++) #define all(v) v.begin(),v.end() using ll=long long; using pll=pair; using tll=tuple; const ll inf=-(1ll<<60),INF=(1ll<<60); template void chmin(T &a,T b){ if(a>b){ a=b; } } template void chmax(T &a,T b){ if(a par,siz; union_find(ll n):par(n),siz(n,1){ rep(i,n){ par[i]=i; } } ll root(ll x){ if(par[x]==x) return x; return par[x]=root(par[x]); } void unite(ll x,ll y){ ll rx=root(x); ll ry=root(y); if(rx==ry) return; if(siz[rx]> g; vector d,prev; graph(ll n){ v=n; g.resize(v); d.resize(v,INF); prev.resize(v,-1); } void add_edge(ll s,ll t,ll cost){ g[s].push_back({t,cost}); } void dijkstra(ll s){ rep(i,d.size()){ d[i]=INF; } priority_queue,greater> pq; d[s]=0; pq.push({0,s}); while(!pq.empty()){ ll x_dist,x_vertex; tie(x_dist,x_vertex)=pq.top(); pq.pop(); if(d[x_vertex] vp; ll kruskal(){ priority_queue,greater> pq; rep(i,g.size()){ for(auto edge:g[i]){ pq.push({edge.cost,i,edge.to}); } } ll min_cost=0; union_find uf(g.size()); while(!pq.empty()){ ll x,x_to,x_cost; tie(x_cost,x,x_to)=pq.top(); pq.pop(); if(!uf.same(x,x_to)){ min_cost+=x_cost; uf.unite(x,x_to); vp.emplace_back(x,x_to); } } return min_cost; } }; void dfs(ll x,vector &vis,vector> &v,vector &ans){ ans.push_back(x); vis[x]=true; for(auto &i:v[x]){ if(vis[i]) continue; dfs(i,vis,v,ans); } if(ans.back()!=x) ans.push_back(x); } int main(){ ll n,m; cin >> n >> m; vector a(n),b(n); rep(i,n){ cin >> a[i] >> b[i]; } graph g(n); rep(i,n){ for(int j=i+1;j> v(n); rep(i,g.vp.size()){ v[g.vp[i].first].push_back(g.vp[i].second); v[g.vp[i].second].push_back(g.vp[i].first); } vector vis(n,false); vector ans; dfs(0,vis,v,ans); vector cv; rep(k,ans.size()-1){ ll i=ans[k]; ll j=ans[k+1]; ll di=(a[i]-a[j])*(a[i]-a[j])+(b[i]-b[j])*(b[i]-b[j]); cv.emplace_back(di,i); cv.emplace_back(di,j); } sort(all(cv)); reverse(all(cv)); vector pans; rep(i,ans.size()){ pans.emplace_back(1,ans[i]+1); } rep(i,m){ ll x=cv[i].second; cout << a[x] << " " << b[x] << endl; ll j=0; while(j