#include<bits/stdc++.h>

using namespace std;

#define ll long long
#define for1(i,a,b) for (int i=(a);i<=(b);i++)
#define for0(i,a,b) for (int i=(a);i<(b);i++)
#define rof1(i,a,b) for (int i=(a);i>=(b);i--)
#define rof0(i,a,b) for (int i=(a);i>(b);i--)
#define fi first
#define se second
#define pb push_back
#define duozu int __T;scanf("%d",&__T);for1(ica,1,__T)
void _r(const int&x){scanf("%d",&x);}
void _r(const ll&x){scanf("%I64d",&x);}
void _r(const char*x){scanf("%s",x);}
void R(){}
template<class T,class... U>void R(const T&head,const U&...tail){_r(head);R(tail...);}
void _w(const char x){putchar(x);}
void _w(const char*x){printf("%s",x);}
void _w(const int x){printf("%d",x);}
void _w(const ll x){printf("%I64d",x);}
void _w(const double x){printf("%.6f",x);}
void W(){}
template<class T,class...U>void W(const T&head,const U&...tail){_w(head);putchar(sizeof...(tail)?' ':'\n');W(tail...);}
const ll mod = 1e9+7;
ll fp1(ll a,ll b){ll ans=1;while (b){if(b&1)ans*=a;b>>=1;a*=a;}return ans;}
ll fp2(ll a,ll b){ll ans=1;while (b){if(b&1)ans=ans*a%mod;b>>=1;a=a*a%mod;}return ans;}
ll Read(){
    ll res=0,flag=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if (ch=='-')flag = -1;ch = getchar();}
    while (ch>='0' && ch<='9'){res = res*10+ch-'0';ch = getchar();}
    return res*flag;
}
#define CL(x) memset(x,0,sizeof x)

const int N = 2e5+5;

vector<int>v[N];

int main()
{
    int n,m,a,b;
    R(n,m);
    for1(i,1,m){
        R(a,b);
        v[a].pb(b);
    }
    for1(i,1,n){
        W((int)(1+v[i].size()) );
        W(i,i);
        for (auto it:v[i]) W(i,it);
    }
    return 0;
}


#include <iostream>
#include <vector>
using namespace std;

int n, m, a, b, lastUsed;

vector< pair<int, int> > pos[105];

int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    pos[i].push_back(make_pair(i, i));
  }
  lastUsed = n + 1;
  for (int i = 0; i < m; i++) {
    cin >> a >> b;
    pos[a].push_back(make_pair(lastUsed, a));
    pos[b].push_back(make_pair(lastUsed, b));
    lastUsed++;
  }
  for (int i = 1; i <= n; i++) {
    cout << pos[i].size() << "\n";
    for (int j = 0; j < pos[i].size(); j++) {
      cout << pos[i][j].first << " " << pos[i][j].second << "\n";
    }
  }
}


#include <iostream>
#include <vector>
using namespace std;

int n, m, a, b, lastUsed;

vector< pair<int, int> > pos[105];

int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    pos[i].push_back(make_pair(i, i));
  }
  lastUsed = n;
  for (int i = 0; i < m; i++) {
    cin >> a >> b;
    pos[a].push_back(make_pair(lastUsed, b));
    pos[b].push_back(make_pair(lastUsed, a));
    lastUsed++;
  }
  for (int i = 1; i <= n; i++) {
    cout << pos[i].size() << "\n";
    for (int j = 0; i < pos[i].size(); i++) {
      cout <<  pos[i][j].first << " " << pos[i][j].second << "\n";
    }
  }
}


#include <iostream>
#include <vector>
using namespace std;

int n, m, a, b, lastUsed;

vector< pair<int, int> > pos[105];

int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    pos[i].push_back(make_pair(i, i));
  }
  lastUsed = n;
  for (int i = 0; i < m; i++) {
    cin >> a >> b;
    pos[a].push_back(make_pair(lastUsed, a));
    pos[b].push_back(make_pair(lastUsed, b));
    lastUsed++;
  }
  for (int i = 1; i <= n; i++) {
    cout << pos[i].size() << "\n";
    for (int j = 0; i < pos[i].size(); i++) {
      cout <<  pos[i][j].first << " " << pos[i][j].second << "\n";
    }
  }
}


#include <iostream>
#include <vector>
using namespace std;

int n, m, a, b, lastUsed;

vector< pair<int, int> > pos[105];

int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    pos[i].push_back(make_pair(i, i));
  }
  lastUsed = n + 1;
  for (int i = 0; i < m; i++) {
    cin >> a >> b;
    pos[a].push_back(make_pair(lastUsed, b));
    pos[b].push_back(make_pair(lastUsed, a));
    lastUsed++;
  }
  for (int i = 1; i <= n; i++) {
    cout << pos[i].size() << "\n";
    for (int j = 0; j < pos[i].size(); j++) {
      cout << pos[i][j].first << " " << pos[i][j].second << "\n";
    }
  }
}


/* code by Pranjal Rai */
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define pb push_back
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const ll M=1e9+7;
ll inf=2e18;
string to_string(ll x){stringstream ss; ss<<x; return ss.str();}
ll to_integer(string s){stringstream ss(s); ll x; ss>>x; return x;}

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    ll n,m;
    cin>>n>>m;
    vector<ll> v[105];
    for(ll i=0;i<m;i++)
    {
        ll a,b;
        cin>>a>>b;
        v[a].pb(b);
    }
    ll x[n+1],y[n+1];
    vector<pair<ll,ll> > ans[105];
    ll c=1;
    for(ll i=1;i<=n;i++)
    {
        y[i]=i;
        for(ll j=1;j<=max(1LL,(ll)v[i].size());j++)
        {
            ans[i].pb({c,i});
            c++;
        }
    }
    for(ll i=1;i<=n;i++)
    {
        ll st=ans[i][0].ff;
        for(ll j=0;j<v[i].size();j++)
        {
            ll a=v[i][j];
            ans[a].pb({st,y[a]});
            st++;
        }
    }
    for(ll i=1;i<=n;i++)
    {
        cout<<ans[i].size()<<"\n";
        for(ll j=0;j<ans[i].size();j++)
            cout<<ans[i][j].ff<<" "<<ans[i][j].ss<<"\n";
    }
    return 0;
}


/* code by Pranjal Rai */
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define pb push_back
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const ll M=1e9+7;
ll inf=2e18;
string to_string(ll x){stringstream ss; ss<<x; return ss.str();}
ll to_integer(string s){stringstream ss(s); ll x; ss>>x; return x;}

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    ll n,m;
    cin>>n>>m;
    vector<pair<ll,ll> > v;
    for(ll i=0;i<m;i++)
    {
        ll x,y;
        cin>>x>>y;
        v.pb({x,y});
    }
    ll vis[n+1];
    memset(vis,0,sizeof vis);
    ll r=1,c=1;
    vector<pair<ll,ll> > ans[105];
    for(ll i=0;i<m;i++)
    {
        ll x=v[i].ff;
        ll y=v[i].ss;
        ans[x].pb({r,c});
        vis[x]++;
        c++;
        ans[y].pb({r,c});
        vis[y]++;
        r++;
    }
    for(ll i=1;i<=n;i++)
    {
        if(vis[i]==0)
        {
            vis[i]++;
            ans[i].pb({r,c});
            r++;
            c++;
        }
    }
    for(ll i=1;i<=n;i++)
    {
        cout<<vis[i]<<"\n";
        for(ll j=0;j<ans[i].size();j++)
        {
            cout<<ans[i][j].ss<<" "<<ans[i][j].ff<<"\n";
        }
    }
    return 0;
}


/* code by Pranjal Rai */
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define pb push_back
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const ll M=1e9+7;
ll inf=2e18;
string to_string(ll x){stringstream ss; ss<<x; return ss.str();}
ll to_integer(string s){stringstream ss(s); ll x; ss>>x; return x;}

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    ll n,m;
    cin>>n>>m;
    vector<ll> v[105];
    for(ll i=0;i<m;i++)
    {
        ll a,b;
        cin>>a>>b;
        v[a].pb(b);
    }
    ll x[n+1],y[n+1];
    vector<pair<ll,ll> > ans[105];
    ll c=1;
    for(ll i=1;i<=n;i++)
    {
        y[i]=i;
        for(ll j=1;j<=n;j++)
        {
            ans[i].pb({c,i});
            c++;
        }
    }
    for(ll i=1;i<=n;i++)
    {
        ll st=ans[i][0].ff;
        for(ll j=0;j<v[i].size();j++)
        {
            ll a=v[i][j];
            ans[a].pb({st,y[a]});
            st++;
        }
    }
    for(ll i=1;i<=n;i++)
    {
        cout<<ans[i].size()<<"\n";
        for(ll j=0;j<ans[i].size();j++)
            cout<<ans[i][j].ff<<" "<<ans[i][j].ss<<"\n";
    }
    return 0;
}


/* code by Pranjal Rai */
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define pb push_back
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const ll M=1e9+7;
ll inf=2e18;
string to_string(ll x){stringstream ss; ss<<x; return ss.str();}
ll to_integer(string s){stringstream ss(s); ll x; ss>>x; return x;}

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    ll n,m;
    cin>>n>>m;
    vector<pair<ll,ll> > v;
    for(ll i=0;i<m;i++)
    {
        ll x,y;
        cin>>x>>y;
        v.pb({x,y});
    }
    ll vis[n+1];
    memset(vis,0,sizeof vis);
    ll r=1,c=1;
    vector<pair<ll,ll> > ans[105];
    for(ll i=0;i<m;i++)
    {
        ll x=v[i].ff;
        ll y=v[i].ss;
        ans[x].pb({r,c});
        vis[x]++;
        c++;
        ans[y].pb({r,c});
        vis[y]++;
        r++;
        c++;
    }
    for(ll i=1;i<=n;i++)
    {
        if(vis[i]==0)
        {
            vis[i]++;
            ans[i].pb({r,c});
            r++;
            c++;
        }
    }
    for(ll i=1;i<=n;i++)
    {
        cout<<vis[i]<<"\n";
        for(ll j=0;j<ans[i].size();j++)
        {
            cout<<ans[i][j].ss<<" "<<ans[i][j].ff<<"\n";
        }
    }
    return 0;
}


/* code by Pranjal Rai */
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define pb push_back
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const ll M=1e9+7;
ll inf=2e18;
string to_string(ll x){stringstream ss; ss<<x; return ss.str();}
ll to_integer(string s){stringstream ss(s); ll x; ss>>x; return x;}

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    ll n,m;
    cin>>n>>m;
    vector<ll> v[105];
    for(ll i=0;i<m;i++)
    {
        ll a,b;
        cin>>a>>b;
        v[a].pb(b);
    }
    ll x[n+1],y[n+1];
    vector<pair<ll,ll> > ans[105];
    ll c=1;
    for(ll i=1;i<=n;i++)
    {
        y[i]=i;
        for(ll j=1;j<=v[i].size();j++)
        {
            ans[i].pb({c,i});
            c++;
        }
    }
    for(ll i=1;i<=n;i++)
    {
        ll st=ans[i][0].ff;
        for(ll j=0;j<v[i].size();j++)
        {
            ll a=v[i][j];
            ans[a].pb({st,y[a]});
            st++;
        }
    }
    for(ll i=1;i<=n;i++)
    {
        cout<<ans[i].size()<<"\n";
        for(ll j=0;j<ans[i].size();j++)
            cout<<ans[i][j].ff<<" "<<ans[i][j].ss<<"\n";
    }
    return 0;
}


/* code by Pranjal Rai */
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define pb push_back
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const ll M=1e9+7;
ll inf=2e18;
string to_string(ll x){stringstream ss; ss<<x; return ss.str();}
ll to_integer(string s){stringstream ss(s); ll x; ss>>x; return x;}

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    ll n,m;
    cin>>n>>m;
    vector<pair<ll,ll> > v;
    for(ll i=0;i<m;i++)
    {
        ll x,y;
        cin>>x>>y;
        v.pb({x,y});
    }
    ll x[n+1],y[n+1];
    for(ll i=1;i<=n;i++)
    {
        x[i]=2*(i-1)+1;
        y[i]=1;
    }
    for(ll i=1;i<=n;i++)
    {
        cout<<"1\n";
        cout<<x[i]<<" "<<y[i]<<"\n";
    }
    return 0;
}


/* code by Pranjal Rai */
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define pb push_back
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const ll M=1e9+7;
ll inf=2e18;
string to_string(ll x){stringstream ss; ss<<x; return ss.str();}
ll to_integer(string s){stringstream ss(s); ll x; ss>>x; return x;}

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    ll n,m;
    cin>>n>>m;
    vector<pair<ll,ll> > v;
    for(ll i=0;i<m;i++)
    {
        ll x,y;
        cin>>x>>y;
        v.pb({x,y});
    }
    ll vis[n+1];
    memset(vis,0,sizeof vis);
    ll r=1,c=1;
    vector<pair<ll,ll> > ans[105];
    for(ll i=0;i<m;i++)
    {
        ll x=v[i].ff;
        ll y=v[i].ss;
        ans[x].pb({r,c});
        vis[x]++;
        c++;
        ans[y].pb({r,c});
        vis[y]++;
        r++;
        c++;
    }
    for(ll i=1;i<=n;i++)
    {
        if(vis[i]==0)
        {
            vis[i]++;
            ans[i].pb({r,c});
            r++;
            c++;
        }
    }
    for(ll i=1;i<=n;i++)
    {
        cout<<vis[i]<<"\n";
        for(ll j=0;j<ans[i].size();j++)
        {
            cout<<ans[i][j].ff<<" "<<ans[i][j].ss<<"\n";
        }
    }
    return 0;
}


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

#define si(n) scanf("%d",&n)
#define ll long long
#define MAX 103

int n,m;
vector<pair<int,int> >ans[MAX];

int main()
{
    //freopen("input.txt","r",stdin);
    int i,j;
    cin>>n>>m;

    for(i=1;i<=n;i++){
        ans[i].push_back({i,i});
    }
    while(m--){
        int u,v;
        cin>>u>>v;
        ans[u].push_back({u,v});
        ans[v].push_back({v,u});
    }

    for(i=1;i<=n;i++){
        printf("%d\n",ans[i].size());
        for(auto x : ans[i])
            printf("%d %d\n",x.first,x.second);
    }

    return 0;
}


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

#define si(n) scanf("%d",&n)
#define ll long long
#define MAX 103

int n,m;
vector<pair<int,int> >ans[MAX];

int main()
{
    //freopen("input.txt","r",stdin);
    int i,j;
    cin>>n>>m;

    for(i=1;i<=n;i++){
        ans[i].push_back({i,i});
    }
    j=n+1;
    while(m--){
        int u,v;
        cin>>u>>v;
        ans[u].push_back({u,j});
        ans[v].push_back({v,j});
        j++;
    }

    for(i=1;i<=n;i++){
        printf("%d\n",ans[i].size());
        for(auto x : ans[i])
            printf("%d %d\n",x.first,x.second);
    }

    return 0;
}


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

#define si(n) scanf("%d",&n)
#define ll long long
#define MAX 103

int n,m;
vector<pair<int,int> >ans[MAX];

int main()
{
    //freopen("input.txt","r",stdin);
    int i,j;
    cin>>n>>m;

    for(i=1;i<=n;i++){
        ans[i].push_back({i,i});
    }
    j=n+1;
    while(m--){
        int u,v;
        cin>>u>>v;
        ans[u].push_back({u,j});
        ans[v].push_back({v,j});
    }

    for(i=1;i<=n;i++){
        printf("%d\n",ans[i].size());
        for(auto x : ans[i])
            printf("%d %d\n",x.first,x.second);
    }

    return 0;
}


#include <bits/stdc++.h>

// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>

#define pii              pair <ll,ll>
#define pll              pair <long long,long long>
#define sc               scanf
#define pf               prllf
#define Pi               2*acos(0.0)
#define ms(a,b)          memset(a, b, sizeof(a))
#define pb(a)            push_back(a)
#define MP               make_pair
#define db               double
#define ll               long long
#define EPS              10E-10
#define ff               first
#define ss               second
#define sqr(x)           (x)*(x)
#define D(x)             cerr<<#x " = "<<(x)<<endl
#define VI               vector <ll>
#define DBG              pf("Hi\n")
#define MOD              1000000007
#define fast_cin         ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define SZ(a)            (ll)a.size()
#define sf(a)            scanf("%lld",&a)
#define sfl(a)           scanf("%lld",&a)
#define sff(a,b)         scanf("%lld %lld",&a,&b)
#define sffl(a,b)        scanf("%lld %lld",&a,&b)
#define sfff(a,b,c)      scanf("%lld %lld %lld",&a,&b,&c)
#define sfffl(a,b,c)     scanf("%lld %lld %lld",&a,&b,&c)
#define stlloop(v)       for(__typeof(v.begin()) it=v.begin();it!=v.end();it++)
#define UNIQUE(v)        (v).erase(unique((v).begin(),(v).end()),(v).end())
#define POPCOUNT         __builtin_popcountll
#define RIGHTMOST        __builtin_ctzll
#define LEFTMOST(x)      (63-__builtin_clzll((x)))
#define NUMDIGIT(x,y)    (((vlong)(log10((x))/log10((y))))+1)
#define NORM(x)          if(x>=mod) x-=mod;if(x<0) x+=mod;
#define ODD(x)           (((x)&1)==0?(0):(1))
#define loop(i,n)        for(ll i=0;i<n;i++)
#define loop1(i,n)       for(ll i=1;i<=n;i++)
#define REP(i,a,b)       for(ll i=a;i<b;i++)
#define RREP(i,a,b)      for(ll i=a;i>=b;i--)
#define TEST_CASE(t)     for(ll z=1;z<=t;z++)
#define PRll_CASE       prllf("Case %lld: ",z)
#define LINE_PRll_CASE  prllf("Case %lld:\n",z)
#define CASE_PRll       cout<<"Case "<<z<<": "
#define all(a)           a.begin(),a.end()
#define lllim           2147483648
#define infinity         (1<<28)
#define ull              unsigned long long
#define gcd(a, b)        __gcd(a, b)
#define lcm(a, b)        ((a)*((b)/gcd(a,b)))

using namespace std;

//using namespace __gnu_pbds;
//typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

/*----------------------Graph Moves----------------*/
const ll fx[]= {+1,-1,+0,+0};
const ll fy[]= {+0,+0,+1,-1};
//const ll fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const ll fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const ll fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const ll fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*------------------------------------------------*/

/*-----------------------Bitmask------------------*/
ll Set(ll N,ll pos)
{
    return N=N | (1<<pos);
}
ll reset(ll N,ll pos)
{
    return N= N & ~(1<<pos);
}

int arr[205][205];
vector < pair < int , int > > ans[205];
int cnt[205];
int main()
{

//    freopen("in.txt","r",stdin);
    // freopen("out.txt","w",stdout);
   int n , m ;
   scanf("%d %d",&n,&m);
   for( int i  = 1 ; i <= n ; i ++ ) {
        arr[i][i] = i ;
   }
   for ( int i = 0 ; i < m ; i ++ ){
       int a , b ;
       scanf("%d %d",&a,&b) ;
       if ( b > a ) arr[b][a] = a ;
       else arr[a][b] = b;
   }
   for( int i = 1 ; i <= n ; i ++ ){
     for( int j = 1 ; j <= n ; j ++ ){
         cnt[arr[i][j]]++ ;
         ans[arr[i][j]].push_back({i,j});
     }
   }
   for( int i = 1  ; i <= n; i ++ ){
     cout << cnt[i] << endl;
     for( int j = 0 ; j < ans[i].size() ; j ++ ) cout << ans[i][j].ff << " " << ans[i][j].ss << endl;
   }

    return 0;
}


#include <bits/stdc++.h>

// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>

#define pii              pair <ll,ll>
#define pll              pair <long long,long long>
#define sc               scanf
#define pf               prllf
#define Pi               2*acos(0.0)
#define ms(a,b)          memset(a, b, sizeof(a))
#define pb(a)            push_back(a)
#define MP               make_pair
#define db               double
#define ll               long long
#define EPS              10E-10
#define ff               first
#define ss               second
#define sqr(x)           (x)*(x)
#define D(x)             cerr<<#x " = "<<(x)<<endl
#define VI               vector <ll>
#define DBG              pf("Hi\n")
#define MOD              1000000007
#define fast_cin         ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define SZ(a)            (ll)a.size()
#define sf(a)            scanf("%lld",&a)
#define sfl(a)           scanf("%lld",&a)
#define sff(a,b)         scanf("%lld %lld",&a,&b)
#define sffl(a,b)        scanf("%lld %lld",&a,&b)
#define sfff(a,b,c)      scanf("%lld %lld %lld",&a,&b,&c)
#define sfffl(a,b,c)     scanf("%lld %lld %lld",&a,&b,&c)
#define stlloop(v)       for(__typeof(v.begin()) it=v.begin();it!=v.end();it++)
#define UNIQUE(v)        (v).erase(unique((v).begin(),(v).end()),(v).end())
#define POPCOUNT         __builtin_popcountll
#define RIGHTMOST        __builtin_ctzll
#define LEFTMOST(x)      (63-__builtin_clzll((x)))
#define NUMDIGIT(x,y)    (((vlong)(log10((x))/log10((y))))+1)
#define NORM(x)          if(x>=mod) x-=mod;if(x<0) x+=mod;
#define ODD(x)           (((x)&1)==0?(0):(1))
#define loop(i,n)        for(ll i=0;i<n;i++)
#define loop1(i,n)       for(ll i=1;i<=n;i++)
#define REP(i,a,b)       for(ll i=a;i<b;i++)
#define RREP(i,a,b)      for(ll i=a;i>=b;i--)
#define TEST_CASE(t)     for(ll z=1;z<=t;z++)
#define PRll_CASE       prllf("Case %lld: ",z)
#define LINE_PRll_CASE  prllf("Case %lld:\n",z)
#define CASE_PRll       cout<<"Case "<<z<<": "
#define all(a)           a.begin(),a.end()
#define lllim           2147483648
#define infinity         (1<<28)
#define ull              unsigned long long
#define gcd(a, b)        __gcd(a, b)
#define lcm(a, b)        ((a)*((b)/gcd(a,b)))

using namespace std;

//using namespace __gnu_pbds;
//typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

/*----------------------Graph Moves----------------*/
const ll fx[]= {+1,-1,+0,+0};
const ll fy[]= {+0,+0,+1,-1};
//const ll fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const ll fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const ll fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const ll fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*------------------------------------------------*/

/*-----------------------Bitmask------------------*/
ll Set(ll N,ll pos)
{
    return N=N | (1<<pos);
}
ll reset(ll N,ll pos)
{
    return N= N & ~(1<<pos);
}

int arr[2005][2005];
vector < pair < int , int > > ans[2005];
int cnt[2005];
int main()
{

//    freopen("in.txt","r",stdin);
    // freopen("out.txt","w",stdout);
   int n , m ;
   scanf("%d %d",&n,&m);
   for( int i  = 1 ; i <= n ; i ++ ) {
        arr[i][i] = i ;
   }
   for ( int i = 0 ; i < m ; i ++ ){
       int a , b ;
       scanf("%d %d",&a,&b) ;
       if ( b > a ) arr[b][a] = a ;
       else arr[a][b] = b;
   }
   for( int i = 1 ; i <= n ; i ++ ){
     for( int j = 1 ; j <= n ; j ++ ){
         cnt[arr[i][j]]++ ;
         ans[arr[i][j]].push_back({i,j});
     }
   }
   for( int i = 1  ; i <= n; i ++ ){
     cout << cnt[i] << endl;
     for( int j = 0 ; j < ans[i].size() ; j ++ ) cout << ans[i][j].ff << " " << ans[i][j].ss << endl;
   }

    return 0;
}


#include <bits/stdc++.h>

// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>

#define pii              pair <ll,ll>
#define pll              pair <long long,long long>
#define sc               scanf
#define pf               prllf
#define Pi               2*acos(0.0)
#define ms(a,b)          memset(a, b, sizeof(a))
#define pb(a)            push_back(a)
#define MP               make_pair
#define db               double
#define ll               long long
#define EPS              10E-10
#define ff               first
#define ss               second
#define sqr(x)           (x)*(x)
#define D(x)             cerr<<#x " = "<<(x)<<endl
#define VI               vector <ll>
#define DBG              pf("Hi\n")
#define MOD              1000000007
#define fast_cin         ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define SZ(a)            (ll)a.size()
#define sf(a)            scanf("%lld",&a)
#define sfl(a)           scanf("%lld",&a)
#define sff(a,b)         scanf("%lld %lld",&a,&b)
#define sffl(a,b)        scanf("%lld %lld",&a,&b)
#define sfff(a,b,c)      scanf("%lld %lld %lld",&a,&b,&c)
#define sfffl(a,b,c)     scanf("%lld %lld %lld",&a,&b,&c)
#define stlloop(v)       for(__typeof(v.begin()) it=v.begin();it!=v.end();it++)
#define UNIQUE(v)        (v).erase(unique((v).begin(),(v).end()),(v).end())
#define POPCOUNT         __builtin_popcountll
#define RIGHTMOST        __builtin_ctzll
#define LEFTMOST(x)      (63-__builtin_clzll((x)))
#define NUMDIGIT(x,y)    (((vlong)(log10((x))/log10((y))))+1)
#define NORM(x)          if(x>=mod) x-=mod;if(x<0) x+=mod;
#define ODD(x)           (((x)&1)==0?(0):(1))
#define loop(i,n)        for(ll i=0;i<n;i++)
#define loop1(i,n)       for(ll i=1;i<=n;i++)
#define REP(i,a,b)       for(ll i=a;i<b;i++)
#define RREP(i,a,b)      for(ll i=a;i>=b;i--)
#define TEST_CASE(t)     for(ll z=1;z<=t;z++)
#define PRll_CASE       prllf("Case %lld: ",z)
#define LINE_PRll_CASE  prllf("Case %lld:\n",z)
#define CASE_PRll       cout<<"Case "<<z<<": "
#define all(a)           a.begin(),a.end()
#define lllim           2147483648
#define infinity         (1<<28)
#define ull              unsigned long long
#define gcd(a, b)        __gcd(a, b)
#define lcm(a, b)        ((a)*((b)/gcd(a,b)))

using namespace std;

//using namespace __gnu_pbds;
//typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

/*----------------------Graph Moves----------------*/
const ll fx[]= {+1,-1,+0,+0};
const ll fy[]= {+0,+0,+1,-1};
//const ll fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const ll fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const ll fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const ll fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*------------------------------------------------*/

/*-----------------------Bitmask------------------*/
ll Set(ll N,ll pos)
{
    return N=N | (1<<pos);
}
ll reset(ll N,ll pos)
{
    return N= N & ~(1<<pos);
}

int arr[2005][2005];
vector < pair < int , int > > ans[2005];
int cnt[2005];
int main()
{

//    freopen("in.txt","r",stdin);
    // freopen("out.txt","w",stdout);
   int n , m ;
   scanf("%d %d",&n,&m);

   for ( int i = 0 ; i < m ; i ++ ){
       int a , b ;
       scanf("%d %d",&a,&b) ;
       if ( b > a ) arr[b][a] = a ;
       else arr[a][b] = b;
   }
   for( int i = 1 ; i <= n ; i ++ ){
     for( int j = 1 ; j <= n ; j ++ ){
         cnt[arr[i][j]]++ ;
         ans[arr[i][j]].push_back({i,j});
     }
   }
   for( int i = 1  ; i <= n; i ++ ){
     cout << cnt[i] << endl;
     for( int j = 0 ; j < ans[i].size() ; j ++ ) cout << ans[i][j].ff << " " << ans[i][j].ss << endl;
   }

    return 0;
}


#include <bits/stdc++.h>

// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>

#define pii              pair <ll,ll>
#define pll              pair <long long,long long>
#define sc               scanf
#define pf               prllf
#define Pi               2*acos(0.0)
#define ms(a,b)          memset(a, b, sizeof(a))
#define pb(a)            push_back(a)
#define MP               make_pair
#define db               double
#define ll               long long
#define EPS              10E-10
#define ff               first
#define ss               second
#define sqr(x)           (x)*(x)
#define D(x)             cerr<<#x " = "<<(x)<<endl
#define VI               vector <ll>
#define DBG              pf("Hi\n")
#define MOD              1000000007
#define fast_cin         ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define SZ(a)            (ll)a.size()
#define sf(a)            scanf("%lld",&a)
#define sfl(a)           scanf("%lld",&a)
#define sff(a,b)         scanf("%lld %lld",&a,&b)
#define sffl(a,b)        scanf("%lld %lld",&a,&b)
#define sfff(a,b,c)      scanf("%lld %lld %lld",&a,&b,&c)
#define sfffl(a,b,c)     scanf("%lld %lld %lld",&a,&b,&c)
#define stlloop(v)       for(__typeof(v.begin()) it=v.begin();it!=v.end();it++)
#define UNIQUE(v)        (v).erase(unique((v).begin(),(v).end()),(v).end())
#define POPCOUNT         __builtin_popcountll
#define RIGHTMOST        __builtin_ctzll
#define LEFTMOST(x)      (63-__builtin_clzll((x)))
#define NUMDIGIT(x,y)    (((vlong)(log10((x))/log10((y))))+1)
#define NORM(x)          if(x>=mod) x-=mod;if(x<0) x+=mod;
#define ODD(x)           (((x)&1)==0?(0):(1))
#define loop(i,n)        for(ll i=0;i<n;i++)
#define loop1(i,n)       for(ll i=1;i<=n;i++)
#define REP(i,a,b)       for(ll i=a;i<b;i++)
#define RREP(i,a,b)      for(ll i=a;i>=b;i--)
#define TEST_CASE(t)     for(ll z=1;z<=t;z++)
#define PRll_CASE       prllf("Case %lld: ",z)
#define LINE_PRll_CASE  prllf("Case %lld:\n",z)
#define CASE_PRll       cout<<"Case "<<z<<": "
#define all(a)           a.begin(),a.end()
#define lllim           2147483648
#define infinity         (1<<28)
#define ull              unsigned long long
#define gcd(a, b)        __gcd(a, b)
#define lcm(a, b)        ((a)*((b)/gcd(a,b)))

using namespace std;

//using namespace __gnu_pbds;
//typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

/*----------------------Graph Moves----------------*/
const ll fx[]= {+1,-1,+0,+0};
const ll fy[]= {+0,+0,+1,-1};
//const ll fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const ll fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const ll fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const ll fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*------------------------------------------------*/

/*-----------------------Bitmask------------------*/
ll Set(ll N,ll pos)
{
    return N=N | (1<<pos);
}
ll reset(ll N,ll pos)
{
    return N= N & ~(1<<pos);
}

int arr[2005][2005];
vector < pair < int , int > > ans[2005];
int cnt[2005];
int main()
{

//    freopen("in.txt","r",stdin);
    // freopen("out.txt","w",stdout);
   int n , m ;
   scanf("%d %d",&n,&m);

   for ( int i = 0 ; i < m ; i ++ ){
       int a , b ;
       scanf("%d %d",&a,&b) ;
       if ( b > a ) arr[b][a] = a ;
       else arr[a][b] = b;
   }
   for( int i = 1 ; i <= n ; i ++ ){
     for( int j = 1 ; j <= n ; j ++ ){
         cnt[arr[i][j]]++ ;
         ans[arr[i][j]].push_back({i,j});
     }
   }
   for( int i= 1 ; i <= n ; i ++ ){
    if ( cnt[i] == 0 ) {
        cnt[i] ++ ;
        ans[i].push_back({i,i});
    }
   }
   for( int i = 1  ; i <= n; i ++ ){
     cout << cnt[i] << endl;
     for( int j = 0 ; j < ans[i].size() ; j ++ ) cout << ans[i][j].ff << " " << ans[i][j].ss << endl;
   }

    return 0;
}


#include <bits/stdc++.h>

// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>

#define pii              pair <ll,ll>
#define pll              pair <long long,long long>
#define sc               scanf
#define pf               prllf
#define Pi               2*acos(0.0)
#define ms(a,b)          memset(a, b, sizeof(a))
#define pb(a)            push_back(a)
#define MP               make_pair
#define db               double
#define ll               long long
#define EPS              10E-10
#define ff               first
#define ss               second
#define sqr(x)           (x)*(x)
#define D(x)             cerr<<#x " = "<<(x)<<endl
#define VI               vector <ll>
#define DBG              pf("Hi\n")
#define MOD              1000000007
#define fast_cin         ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define SZ(a)            (ll)a.size()
#define sf(a)            scanf("%lld",&a)
#define sfl(a)           scanf("%lld",&a)
#define sff(a,b)         scanf("%lld %lld",&a,&b)
#define sffl(a,b)        scanf("%lld %lld",&a,&b)
#define sfff(a,b,c)      scanf("%lld %lld %lld",&a,&b,&c)
#define sfffl(a,b,c)     scanf("%lld %lld %lld",&a,&b,&c)
#define stlloop(v)       for(__typeof(v.begin()) it=v.begin();it!=v.end();it++)
#define UNIQUE(v)        (v).erase(unique((v).begin(),(v).end()),(v).end())
#define POPCOUNT         __builtin_popcountll
#define RIGHTMOST        __builtin_ctzll
#define LEFTMOST(x)      (63-__builtin_clzll((x)))
#define NUMDIGIT(x,y)    (((vlong)(log10((x))/log10((y))))+1)
#define NORM(x)          if(x>=mod) x-=mod;if(x<0) x+=mod;
#define ODD(x)           (((x)&1)==0?(0):(1))
#define loop(i,n)        for(ll i=0;i<n;i++)
#define loop1(i,n)       for(ll i=1;i<=n;i++)
#define REP(i,a,b)       for(ll i=a;i<b;i++)
#define RREP(i,a,b)      for(ll i=a;i>=b;i--)
#define TEST_CASE(t)     for(ll z=1;z<=t;z++)
#define PRll_CASE       prllf("Case %lld: ",z)
#define LINE_PRll_CASE  prllf("Case %lld:\n",z)
#define CASE_PRll       cout<<"Case "<<z<<": "
#define all(a)           a.begin(),a.end()
#define lllim           2147483648
#define infinity         (1<<28)
#define ull              unsigned long long
#define gcd(a, b)        __gcd(a, b)
#define lcm(a, b)        ((a)*((b)/gcd(a,b)))

using namespace std;

//using namespace __gnu_pbds;
//typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

/*----------------------Graph Moves----------------*/
const ll fx[]= {+1,-1,+0,+0};
const ll fy[]= {+0,+0,+1,-1};
//const ll fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const ll fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const ll fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const ll fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*------------------------------------------------*/

/*-----------------------Bitmask------------------*/
ll Set(ll N,ll pos)
{
    return N=N | (1<<pos);
}
ll reset(ll N,ll pos)
{
    return N= N & ~(1<<pos);
}

pair < int , int > arr [205];
vector < int > v[205];
int main()
{

//    freopen("in.txt","r",stdin);
    // freopen("out.txt","w",stdout);
   int n , m ;
   scanf("%d %d",&n,&m);
   int cnt = 1 ;
   for( int i = 0 ; i < m ; i ++ ){
      int a , b ;
      scanf("%d %d",&a,&b);
      v[a].push_back(cnt);
      v[b].push_back(cnt);
      cnt ++ ;
   }
   for( int i = 1 ; i <= n ; i ++ ){
    if (v[i].size() == 0 ) {
        v[i].push_back(cnt);
        cnt ++ ;
    }
   }

   for ( int i = 1 ; i <= n ; i ++ ){
     cout << v[i].size() << endl;
     for( int j = 0  ; j < v[i].size() ; j ++ ) cout << i << " " <<v[i][j] << endl;
   }

    return 0;
}


#include <bits/stdc++.h>
#define ll long long
#define pll pair<ll,ll>
#define fr first
#define sc second

using namespace std;

const ll N = 110;

vector <ll> Adj[N];
vector <pll> Ans[N];

int main()
{
    ll n,m; cin>>n>>m;

    while(m--)
    {
        ll x,y; cin>>x>>y;

        if(x>y) swap(x,y);

        Adj[x].push_back(y);
    }

    ll C = 1e9;

    for(ll i=1;i<=n;i++)
    {
        Ans[i].push_back(pll(i,i));

        for(auto j:Adj[i])  Ans[i].push_back(pll(i,C)) , Ans[j].push_back(pll(j,C--));
    }

    for(ll i=1;i<=n;i++)
    {
        printf("%I64d\n",(ll)Ans[i].size());

        for(auto x:Ans[i])  printf("%I64d %I64d\n",x.fr,x.sc);
    }
}


#include <bits/stdc++.h>
#define ll long long
#define pll pair<ll,ll>
#define fr first
#define sc second

using namespace std;

const ll N = 110;

vector <ll> Adj[N];
vector <pll> Ans[N];

int main()
{
    ll n,m; cin>>n>>m;

    while(m--)
    {
        ll x,y; cin>>x>>y;

        if(x>y) swap(x,y);

        Adj[x].push_back(y);
    }

    ll C = 1e9;

    for(ll i=1;i<=n;i++)
    {
        Ans[i].push_back(pll(i,i));

        for(auto j:Adj[i])  Ans[i].push_back(pll(i,C)) , Ans[j].push_back(pll(j,C--));
    }

    for(ll i=1;i<=n;i++)
    {
        printf("%I64d\n",(ll)Ans[i].size()+1LL);

        for(auto x:Ans[i])  printf("%I64d %I64d\n",x.fr,x.sc);
    }
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n, m;
    cin >> n >> m;

    vector <vector <pair <int,int>>> Ans(n + 1);
    for(int x = 1; x <= n; x++) Ans[x].emplace_back(x, x);

    for(int J = n + 1; m--; J++)
    {
        int x, y;
        scanf("%d%d", &x, &y);

        Ans[x].emplace_back(x, J);
        Ans[y].emplace_back(y, J);
    }

    for(int x = 1; x <= n; x++)
    {
        printf("%d\n", (int) Ans[x].size());
        for(pair <int,int> p : Ans[x])
            printf("%d %d\n", p.first, p.second);
    }
}


#include <bits/stdc++.h>
#define ll long long

using namespace std;

const ll N = 110;

vector <ll> Adj[N];

int main()
{
    ll n,m; cin>>n>>m;

    for(ll i=1;i<=n;i++)    Adj[i].push_back(i);

    while(m--)
    {
        ll x,y; cin>>x>>y;

        if(x>y) swap(x,y);

        Adj[x].push_back(y);
    }

    for(ll i=1;i<=n;i++)
    {
        printf("%I64d\n",(ll)Adj[i].size());

        for(auto j:Adj[i])  printf("%I64d %I64d\n",i,j);
    }
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n, m;
    cin >> n >> m;

    vector <vector <pair <int,int>>> Ans(n + 1);
    for(int x = 1; x <= n; x++) Ans[x].emplace_back(x, x);

    while(m--)
    {
        int x, y;
        scanf("%d%d", &x, &y);

        if(x > y)   swap(x, y);
        Ans[y].emplace_back(x, y);
    }

    for(int x = 1; x <= n; x++)
    {
        printf("%d\n", (int) Ans[x].size());
        for(pair <int,int> p : Ans[x])
            printf("%d %d\n", p.first, p.second);
    }
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include<stack>
typedef long long ll;
typedef long double ld;

using namespace std;

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

	ll n, m;
	cin >> n >> m;
	vector<vector<ll>>g(n);
	ll tmp = 0;
	for (ll i = 0; i < m; i++) {
		ll a, b;
		cin >> a >> b;
		g[a - 1].push_back(tmp);
		g[b - 1].push_back(tmp);
		tmp++;
	}
	for (ll i = 0; i < n; i++) {
		g[i].push_back(tmp);
		tmp++;
		cout << g[i].size() << '\n';
		for (ll j = 0; j < g[i].size(); j++) {
			cout << i + 1 << ' ' << g[i][j]  + 1 << '\n';
		}
	}
	return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include<stack>
typedef long long ll;
typedef long double ld;

using namespace std;

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

	ll n, m;
	cin >> n >> m;
	for (ll i = 0; i < m; i++) {
		ll a, b;
		cin >> a >> b;
	}
	for (ll i = 1; i <= n; i++) {
		cout << 1 << '\n' << i << ' ' << i << '\n';
	}
	return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include<stack>
typedef long long ll;
typedef long double ld;

using namespace std;

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

	ll n, m;
	cin >> n >> m;
	vector<vector<ll>>g(n);
	ll tmp = 0;
	for (ll i = 0; i < m; i++) {
		ll a, b;
		cin >> a >> b;
		g[a - 1].push_back(tmp);
		g[b - 1].push_back(tmp);
		tmp++;
	}
	for (ll i = 0; i < n; i++) {
		cout << g[i].size() << '\n';
		for (ll j = 0; j < g[i].size(); j++) {
			cout << i + 1 << ' ' << g[i][j] + 1 << '\n';
		}
	}
	return 0;
}


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

#define mx 10000001
#define ll long long int

struct node
{
    ll x,y;
};

ll ax[101],ay[101];
bool vis[101];

int main()
{
    ll n,m,k,l,a,b;
    cin>>n>>m;
    vector<node>ans[n+1];
    for(int i=1; i<=n; i++)
        ans[i].push_back({i,i});
    for(int i=0; i<m; i++)
    {
        cin>>k>>l;
        ans[k].push_back({k,n*k+l});
        ans[l].push_back({l,n*k+l});
    }
    for(int i=1; i<=n; i++)
    {
        cout<<ans[i].size()<<endl;
        for(int j=0; j<ans[i].size(); j++)
        {
            a=ans[i][j].x;
            b=ans[i][j].y;
            cout<<a<<" "<<b<<endl;
        }
    }
    return 0;
}


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

#define mx 10000001
#define ll long long int

struct node
{
    ll x,y;
};

ll ax[101],ay[101];
bool vis[101];

int main()
{
    ll n,m,k,l;
    cin>>n>>m;
    ll x=100000000,u,v,a,b,c,d,e,f;
    vector<ll>adj[n+1];
    for(int i=0;i<m;i++)
    {
        cin>>k>>l;
        adj[min(k,l)].push_back(max(k,l));
    }
    queue<pair<ll,ll> >q;
    q.push({1,0});
    vector<node>ans[n+1];
    ans[1].push_back({x,x});
    ax[1]=ay[1]=x;
    while(!q.empty())
    {
        a=q.front().first;
        b=q.front().second;
        q.pop();
        c=ax[a];
        d=ay[a];
        vis[a]=1;
        x-=100;
        for(int i=0;i<adj[a].size();i++)
        {
            u=adj[a][i];
            if(vis[u])
                continue;
            if(b==0)
            {
                e=c+x;
                f=d;
                ax[u]=e;
                ay[u]=f;
                ans[u].push_back({e,f});
                q.push({u,1});
            }
            else
            {
                e=c;
                f=d+x;
                ax[u]=e;
                ay[u]=f;
                ans[u].push_back({e,f});
                q.push({u,0});
            }
        }
    }
    for(int i=1;i<=n;i++)
    {
        //cout<<i<<endl;
        cout<<ans[i].size()<<endl;
        for(int j=0;j<ans[i].size();j++)
        {
            a=ans[i][j].x;
            b=ans[i][j].y;
            cout<<a<<" "<<b<<endl;
        }
    }
    return 0;
}


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

#define mx 10000001
#define ll long long int

struct node
{
    ll x,y;
};

ll ax[101],ay[101];
bool vis[101];

int main()
{
    ll n,m,k,l;
    cin>>n>>m;
    ll x=100000,u,v,a,b,c,d,e,f;
    vector<ll>adj[n+1];
    for(int i=0;i<m;i++)
    {
        cin>>k>>l;
        adj[min(k,l)].push_back(max(k,l));
    }
    queue<pair<ll,ll> >q;
    q.push({1,0});
    vector<node>ans[n+1];
    ans[1].push_back({x,x});
    ax[1]=ay[1]=x;
    vis[1]=1;
    ll z=x;
    while(!q.empty())
    {
        a=q.front().first;
        b=q.front().second;
        q.pop();
        c=ax[a];
        d=ay[a];
        //vis[a]=1;
        z-=100;
        x=z;
        for(int i=0;i<adj[a].size();i++)
        {
            u=adj[a][i];
            if(vis[u])
                continue;
            vis[u]=1;
            if(b==0)
            {
                e=c+x;
                f=d;
                ax[u]=e;
                ay[u]=f;
                ans[u].push_back({e,f});
                q.push({u,1});
                x+=z;
            }
            else
            {
                e=c;
                f=d+x;
                ax[u]=e;
                ay[u]=f;
                ans[u].push_back({e,f});
                q.push({u,0});
                x+=z;
            }
        }
    }
    u=1;
    v=1;
    for(int i=1;i<=n;i++)
    {
        //cout<<i<<endl;
        if(ans[i].size()==0)
        {
            ans[i].push_back({u,v});
            u++;
            v++;
        }
        cout<<ans[i].size()<<endl;
        for(int j=0;j<ans[i].size();j++)
        {
            a=ans[i][j].x;
            b=ans[i][j].y;
            cout<<a<<" "<<b<<endl;
        }
    }
    return 0;
}


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

#define mx 10000001
#define ll long long int

struct node
{
    ll x,y;
};

ll ax[101],ay[101];
bool vis[101];

int main()
{
    ll n,m,k,l;
    cin>>n>>m;
    ll x=100000,u,v,a,b,c,d,e,f;
    vector<ll>adj[n+1];
    for(int i=0;i<m;i++)
    {
        cin>>k>>l;
        adj[min(k,l)].push_back(max(k,l));
    }
    queue<pair<ll,ll> >q;
    q.push({1,0});
    vector<node>ans[n+1];
    ans[1].push_back({x,x});
    ax[1]=ay[1]=x;
    vis[1]=1;
    ll z=x;
    while(!q.empty())
    {
        a=q.front().first;
        b=q.front().second;
        q.pop();
        c=ax[a];
        d=ay[a];
        //vis[a]=1;
        z-=100;
        x=z;
        for(int i=0;i<adj[a].size();i++)
        {
            u=adj[a][i];
            if(vis[u])
                continue;
            vis[u]=1;
            if(b==0)
            {
                e=c+x;
                f=d;
                ax[u]=e;
                ay[u]=f;
                ans[u].push_back({e,f});
                q.push({u,1});
                x+=z;
            }
            else
            {
                e=c;
                f=d+x;
                ax[u]=e;
                ay[u]=f;
                ans[u].push_back({e,f});
                q.push({u,0});
                x+=z;
            }
        }
    }
    for(int i=1;i<=n;i++)
    {
        //cout<<i<<endl;
        cout<<ans[i].size()<<endl;
        for(int j=0;j<ans[i].size();j++)
        {
            a=ans[i][j].x;
            b=ans[i][j].y;
            cout<<a<<" "<<b<<endl;
        }
    }
    return 0;
}


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

#define mx 10000001
#define ll long long int

struct node
{
    ll x,y;
};

ll ax[101],ay[101];
bool vis[101];

int main()
{
    ll n,m,k,l;
    cin>>n>>m;
    ll x=100000,u,v,a,b,c,d,e,f;
    vector<ll>adj[n+1];
    for(int i=0;i<m;i++)
    {
        cin>>k>>l;
        adj[min(k,l)].push_back(max(k,l));
    }
    queue<pair<ll,ll> >q;
    q.push({1,0});
    vector<node>ans[n+1];
    ans[1].push_back({x,x});
    ax[1]=ay[1]=x;
    ll z=x;
    while(!q.empty())
    {
        a=q.front().first;
        b=q.front().second;
        q.pop();
        c=ax[a];
        d=ay[a];
        vis[a]=1;
        z-=100;
        x=z;
        for(int i=0;i<adj[a].size();i++)
        {
            u=adj[a][i];
            if(vis[u])
                continue;
            if(b==0)
            {
                e=c+x;
                f=d;
                ax[u]=e;
                ay[u]=f;
                ans[u].push_back({e,f});
                q.push({u,1});
                x+=z;
            }
            else
            {
                e=c;
                f=d+x;
                ax[u]=e;
                ay[u]=f;
                ans[u].push_back({e,f});
                q.push({u,0});
                x+=z;
            }
        }
    }
    for(int i=1;i<=n;i++)
    {
        //cout<<i<<endl;
        cout<<ans[i].size()<<endl;
        for(int j=0;j<ans[i].size();j++)
        {
            a=ans[i][j].x;
            b=ans[i][j].y;
            cout<<a<<" "<<b<<endl;
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int n,m,x,y,a[5003];
vector <int> c[5003];
int main()
{
	cin>>n>>m;
	for(int i=1;i<=m;i++)
		cin>>x>>y,a[x]++,c[x].push_back(y);
	for(int i=1;i<=n;i++){
		cout<<a[i]+1<<endl<<i<<" "<<i<<endl;
		for(int j=0;j<a[i];j++)
			cout<<i<<" "<<c[i][j]<<endl;
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int n,m,x,y,a[5003];
vector <int> c[5003];
int main()
{
	cin>>n>>m;
	for(int i=1;i<=m;i++){
		cin>>x>>y;
		if(x<y)swap(x,y);
		a[x]++,c[x].push_back(y);
	}
	for(int i=1;i<=n;i++){
		cout<<a[i]+1<<endl<<i<<" "<<i<<endl;
		for(int j=0;j<a[i];j++)
			cout<<i<<" "<<c[i][j]<<endl;
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int n,m,x,y,a[5003];
vector <int> c[5003];
int main()
{
	cin>>n>>m;
	for(int i=1;i<=m;i++){
		cin>>x>>y;
		if(x>y)swap(x,y);
		a[x]++,c[x].push_back(y);
	}
	for(int i=1;i<=n;i++){
		cout<<a[i]+1<<endl<<i<<" "<<i<<endl;
		for(int j=0;j<a[i];j++)
			cout<<i<<" "<<c[i][j]<<endl;
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int n,m,x,y,a[5003];
vector <int> c[5003];
int main()
{
	cin>>n>>m;
	for(int i=1;i<=m;i++){
		if(x<y)swap(x,y);
		cin>>x>>y,a[x]++,c[x].push_back(y);
	}
	for(int i=1;i<=n;i++){
		cout<<a[i]+1<<endl<<i<<" "<<i<<endl;
		for(int j=0;j<a[i];j++)
			cout<<i<<" "<<c[i][j]<<endl;
	}
	return 0;
}


#include <cstdio>
#include <bits/stdc++.h>
using namespace std;
#define For(i,l,r) for(int (i)=(int)(l);(i)<(int)(r);++(i))
#define FOR(i,l,r) for(int (i)=(int)(l);(i)<=(int)(r);++(i))
#define rof(i,l,r) for(int (i)=(int)(l);(i)>=(int)(r);--(i))
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pii;

const int mxn=105;
int n,m;
vector<pii> ans[mxn];
int main(){
    scanf("%d%d",&n,&m);
    FOR(i,1,m){
        int u,v;scanf("%d%d",&u,&v);
        if(u>v)swap(u,v);
        ans[u].pb(pii(100*(v-1)+u+1,100*(u-1)+v+1));
    }
    FOR(i,1,n){
        printf("%d\n",199+(int)ans[i].size());
        FOR(j,1,100)printf("%d %d\n",100*(i-1)+1,100*(i-1)+j+1);
        For(j,1,100)printf("%d %d\n",100*(i-1)+j+1,100*i+1);
        for(auto node:ans[i])printf("%d %d\n",node.first,node.second);
    }
    return 0;
}


#include <cstdio>
#include <bits/stdc++.h>
using namespace std;
#define For(i,l,r) for(int (i)=(int)(l);(i)<(int)(r);++(i))
#define FOR(i,l,r) for(int (i)=(int)(l);(i)<=(int)(r);++(i))
#define rof(i,l,r) for(int (i)=(int)(l);(i)>=(int)(r);--(i))
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pii;

const int mxn=105;
int n,m;
vector<pii> ans[mxn];
int main(){
    scanf("%d%d",&n,&m);
    FOR(i,1,m){
        int u,v;scanf("%d%d",&u,&v);
        if(u>v)swap(u,v);
        ans[u].pb(pii(100*(v-1)+u,100*(u-1)+v));
    }
    FOR(i,1,n){
        printf("%d\n",201+(int)ans[i].size());
        FOR(j,0,100)printf("%d %d\n",100*(i-1),100*(i-1)+j);
        FOR(j,1,100)printf("%d %d\n",100*(i-1)+j,100*i);
        for(auto node:ans[i])printf("%d %d\n",node.first,node.second);
    }
    return 0;
}


#include <cstdio>
#include <bits/stdc++.h>
using namespace std;
#define For(i,l,r) for(int (i)=(int)(l);(i)<(int)(r);++(i))
#define FOR(i,l,r) for(int (i)=(int)(l);(i)<=(int)(r);++(i))
#define rof(i,l,r) for(int (i)=(int)(l);(i)>=(int)(r);--(i))
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pii;

const int mxn=105;
int n,m;
vector<pii> ans[mxn];
int main(){
    scanf("%d%d",&n,&m);
    FOR(i,1,m){
        int u,v;scanf("%d%d",&u,&v);
        if(u>v)swap(u,v);
        ans[u].pb(pii(100*(v-1)+u,100*(u-1)+v));
    }
    FOR(i,1,n){
        printf("%d\n",199+(int)ans[i].size());
        FOR(j,1,100)printf("%d %d\n",100*(i-1),100*(i-1)+j);
        FOR(j,1,100)printf("%d %d\n",100*(i-1)+j,100*i);
        for(auto node:ans[i])printf("%d %d\n",node.first,node.second);
    }
    return 0;
}


#include <cstdio>
#include <bits/stdc++.h>
using namespace std;
#define For(i,l,r) for(int (i)=(int)(l);(i)<(int)(r);++(i))
#define FOR(i,l,r) for(int (i)=(int)(l);(i)<=(int)(r);++(i))
#define rof(i,l,r) for(int (i)=(int)(l);(i)>=(int)(r);--(i))
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pii;

const int mxn=105;
int n,m;
vector<pii> ans[mxn];
int main(){
    scanf("%d%d",&n,&m);
    FOR(i,1,m){
        int u,v;scanf("%d%d",&u,&v);
        if(u>v)swap(u,v);
        ans[u].pb(pii(100*(v-1)+u+1,100*(u-1)+v+1));
    }
    FOR(i,1,n){
        printf("%d\n",200+(int)ans[i].size());
        FOR(j,1,100)printf("%d %d\n",100*(i-1)+1,100*(i-1)+j+1);
        FOR(j,1,100)printf("%d %d\n",100*(i-1)+j+1,100*i+1);
        for(auto node:ans[i])printf("%d %d\n",node.first,node.second);
    }
    return 0;
}


#include <cstdio>
#include <bits/stdc++.h>
using namespace std;
#define For(i,l,r) for(int (i)=(int)(l);(i)<(int)(r);++(i))
#define FOR(i,l,r) for(int (i)=(int)(l);(i)<=(int)(r);++(i))
#define rof(i,l,r) for(int (i)=(int)(l);(i)>=(int)(r);--(i))
typedef pair<int,int> pii;
typedef long long ll;

int n,m;
vector<int> ans[101];
int main(){
    scanf("%d%d",&n,&m);
    FOR(i,1,m){
        int u,v;scanf("%d%d",&u,&v);
        ans[u].push_back(i);
        ans[v].push_back(i);
    }
    FOR(i,1,n){
        if(!ans[i].empty()){
            printf("%d\n",(int)ans[i].size());
            for(auto j:ans[i])printf("%d %d\n",i,j);
        }else{
            puts("1");
            printf("%d %d\n",i,i);
        }
    }
    return 0;
}


#include <cstdio>
#include <bits/stdc++.h>
using namespace std;
#define For(i,l,r) for(int (i)=(int)(l);(i)<(int)(r);++(i))
#define FOR(i,l,r) for(int (i)=(int)(l);(i)<=(int)(r);++(i))
#define rof(i,l,r) for(int (i)=(int)(l);(i)>=(int)(r);--(i))
typedef pair<int,int> pii;
typedef long long ll;

int n,m;
vector<int> ans[101];
int main(){
    scanf("%d%d",&n,&m);
    FOR(i,1,m){
        int u,v;scanf("%d%d",&u,&v);
        ans[u].push_back(i);
        ans[v].push_back(i);
    }
    FOR(i,1,n){
        if(!ans[i].empty()){
            printf("%d\n",(int)ans[i].size());
            for(auto j:ans[i])printf("%d %d\n",i,j);
        }else{
            puts("1");
            printf("%d %d\n",i,++m);
        }
    }
    return 0;
}


#include <bits/stdc++.h>

#define ll long long
#define ull unsigned long long
#define S second
#define F first

using namespace std;

vector <pair<int, int> > ans[10000];

int main()
{
    int n, m;
    cin>>n>>m;
    for(int i = 0; i<n; i++)
    {
        ans[i].push_back({10000000 - i, i});
    }
    for(int i = 0; i<m; i++)
    {
        int l, r;
        cin>>l>>r;
        ans[l-1].push_back({i + 1, l-1});
        ans[r-1].push_back({i + 1, r- 1});
    }
    for(int i = 0; i<n; i++)
    {
        cout<<ans[i].size()<<'\n';
        for(int j = 0; j<ans[i].size(); j++)
        {
            cout<<ans[i][j].first + 1<<" "<<ans[i][j].second + 1<<'\n';
        }
    }
}


#include <bits/stdc++.h>

#define ll long long
#define ull unsigned long long
#define S second
#define F first

using namespace std;

vector <pair<int, int> > ans[10000];

int main()
{
    int n, m;
    cin>>n>>m;
    for(int i = 0; i<n; i++)
    {
        ans[i].push_back({i, i});
    }
    for(int i = 0; i<m; i++)
    {
        int l, r;
        cin>>l>>r;
        if(l > r)
            swap(l, r);
        ans[l-1].push_back({l-1, r-1});
    }
    for(int i = 0; i<n; i++)
    {
        cout<<ans[i].size()<<'\n';
        for(int j = 0; j<ans[i].size(); j++)
        {
            cout<<ans[i][j].first + 1<<" "<<ans[i][j].second + 1<<'\n';
        }
    }
}


#include <bits/stdc++.h>

#define ll long long
#define ull unsigned long long
#define S second
#define F first

using namespace std;

vector <pair<int, int> > ans[10000];

int main()
{
    int n, m;
    cin>>n>>m;
    for(int i = 0; i<n; i++)
    {
        for(int j = (i)*(i + 1)/2; j < (i)*(i + 1)/2 + i + 1; j++)
            ans[i].push_back({i, j});
    }
    for(int i = 0; i<m; i++)
    {
        int l, r;
        cin>>l>>r;
        if(l > r)
            swap(l, r);
        ans[l-1].push_back({l-1, (r-1)*r/2 + l-1});
    }
    for(int i = 0; i<n; i++)
    {
        cout<<ans[i].size()<<'\n';
        for(int j = 0; j<ans[i].size(); j++)
        {
            cout<<ans[i][j].first + 1<<" "<<ans[i][j].second + 1<<'\n';
        }
    }
}


#include <bits/stdc++.h>

#define ll long long
#define ull unsigned long long
#define S second
#define F first

using namespace std;

vector <pair<int, int> > ans[10000];

int main()
{
    int n, m;
    cin>>n>>m;
    for(int i = 0; i<n; i++)
    {
        for(int j = 0; j < n; j++)
            ans[i].push_back({i, j*5000 + i});
    }
    for(int i = 0; i<m; i++)
    {
        int l, r;
        cin>>l>>r;
        if(l > r)
            swap(l, r);
        ans[l-1].push_back({l-1, (l-1) * 5000 + r-1});
    }
    for(int i = 0; i<n; i++)
    {
        cout<<ans[i].size()<<'\n';
        for(int j = 0; j<ans[i].size(); j++)
        {
            cout<<ans[i][j].first + 1<<" "<<ans[i][j].second + 1<<'\n';
        }
    }
}


#include <bits/stdc++.h>

#define ll long long
#define ull unsigned long long
#define S second
#define F first

using namespace std;

vector <pair<int, int> > ans[10000];

int main()
{
    int n, m;
    cin>>n>>m;
    for(int i = 0; i<n; i++)
    {
        ans[i].push_back({i, i});
    }
    for(int i = 0; i<m; i++)
    {
        int l, r;
        cin>>l>>r;
        if(l > r)
            swap(l, r);
        ans[l-1].push_back({l-1, r-1});
    }
    for(int i = 0; i<n; i++)
    {
        cout<<i + 1<<'\n';
        for(int j = 0; j<=i; j++)
        {
            cout<<i + 1<<" "<<j + 1<<'\n';
        }
    }
}


#include <bits/stdc++.h>

#define ll long long
#define ull unsigned long long
#define S second
#define F first

using namespace std;

vector <pair<int, int> > ans[10000];

int main()
{
    int n, m;
    cin>>n>>m;
    for(int i = 0; i<n; i++)
    {
        ans[i].push_back({i, i});
    }
    for(int i = 0; i<m; i++)
    {
        int l, r;
        cin>>l>>r;
        if(l > r)
            swap(l, r);
        ans[l-1].push_back({l-1, r-1});
    }
    for(int i =0; i<n; i++)
    {
        cout<<ans[i].size()<<'\n';;
        for(int j = 0; j<ans[i].size(); j++)
        {
            cout<<ans[i][j].first + 1<<" "<<ans[i][j].second + 1<<'\n';
        }
    }
}


#include <bits/stdc++.h>
#define INT long long int
#define oo 6*(1e18)
using namespace std;
INT n, m, cnt;
vector<INT> G[110];
int main()
{
    ios::sync_with_stdio(false);
    cin>>n>>m;
    for(int i = 0 ; i < m ; i++ )
    {
        INT a, b;
        cin>>a>>b;
        if( a == b ) continue;
        if( a > b ) swap(a, b);
        G[a].push_back(b);
    }
    for(int i = 1 ; i <= n ; i++ )
    {
        cout<<G[i].size()+1<<endl;
        cout<<i<<" "<<i+(i-1)*100<<endl;
        for(INT x : G[i]) cout<<i<<" "<<x+(x-1)*100<<endl;
    }
    return 0;
}


#include <bits/stdc++.h>
#define INT long long int
#define oo 6*(1e18)
using namespace std;
INT n, m;
vector<INT> G[5050];
int main()
{
    ios::sync_with_stdio(false);
    cin>>n>>m;
    for(int i = 0 ; i < m ; i++ )
    {
        INT a, b;
        cin>>a>>b;
        if( a > b ) swap(a, b);
        G[a].push_back(b);
    }
    for(int i = 1 ; i <= n ; i++ )
    {
        cout<<G[i].size()+1<<endl;
        cout<<i<<" "<<i<<endl;
        for(INT x : G[i]) cout<<i<<" "<<x<<endl;
    }
    return 0;
}


#include <bits/stdc++.h>
#define INT long long int
#define oo 6*(1e18)
using namespace std;
INT n, m;
vector<INT> G[5050];
int main()
{
    ios::sync_with_stdio(false);
    cin>>n>>m;
    for(int i = 0 ; i < m ; i++ )
    {
        INT a, b;
        cin>>a>>b;
        G[a].push_back(b);
    }
    for(int i = 1 ; i <= n ; i++ )
    {
        cout<<G[i].size()+1<<endl;
        cout<<i<<" "<<i<<endl;
        for(INT x : G[i]) cout<<i<<" "<<x<<endl;
    }
    return 0;
}


#include <bits/stdc++.h>
#define INT long long int
#define oo 6*(1e18)
using namespace std;
INT n, m, cnt;
vector<INT> G[110],ans[110];
int main()
{
    ios::sync_with_stdio(false);
    cin>>n>>m;
    for(int i = 1 ; i <= n ; i++ )
        ans[i].push_back(i);
    for(int i = 0, p = n+1 ; i < m ; i++ )
    {
        INT a, b;
        cin>>a>>b;
        if( a == b ) continue;
        if( a > b ) swap(a, b);
        ans[a].push_back(p);
        ans[b].push_back(p++);
    }
    for(int i = 1 ; i <= n ; i++ )
    {
        cout<<ans[i].size()<<endl;
        for(INT x : ans[i]) cout<<i<<" "<<x<<endl;
    }
    return 0;
}


#include <bits/stdc++.h>
#define INT long long int
#define oo 6*(1e18)
using namespace std;
INT n, m;
vector<INT> G[5050];
int main()
{
    ios::sync_with_stdio(false);
    cin>>n>>m;
    for(int i = 0 ; i < m ; i++ )
    {
        INT a, b;
        cin>>a>>b;
        if( a == b ) continue;
        if( a > b ) swap(a, b);
        G[a].push_back(b);
    }
    for(int i = 1 ; i <= n ; i++ )
    {
        cout<<G[i].size()+1<<endl;
        cout<<i<<" "<<i<<endl;
        for(INT x : G[i]) cout<<i<<" "<<x<<endl;
    }
    return 0;
}


#include <bits/stdc++.h>
#define MAXN 100+5
using namespace std;

long long int n, m, a, b, k;
bool arr[MAXN][MAXN];

int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    arr[i][i] = 1;
  }
  for (int i = 0; i < m; i++) {
    cin >> a >> b;
    if (b > a) swap(a, b);
    arr[a][b] = 1;
  }
  for (int i = 1;i <= n; i++) {
    k = 0;
    for (int j = 1; j <= n; j++) {
      if (arr[i][j]) k++;
    }
    cout << k << endl;
    for (int j = 1; j <= n; j++) {
      if (arr[i][j]) cout << i << " " << j << endl;
    }
  }
  return 0;
}


#include <bits/stdc++.h>
#define MAXN 100+5
using namespace std;

long long int n, m, a, b, k;
bool arr[MAXN][MAXN];

int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    arr[i][i] = 1;
  }
  for (int i = 1; i <= m; i++) {
    cin >> a >> b;
    if (b > a) swap(a, b);
    arr[a][n+i] = 1;
    arr[b][n+i] = 1;
  }
  for (int i = 1;i <= n; i++) {
    k = 0;
    for (int j = 1; j <= n+m; j++) {
      if (arr[i][j]) k++;
    }
    cout << k << endl;
    for (int j = 1; j <= n+m; j++) {
      if (arr[i][j]) cout << i << " " << j << endl;
    }
  }
  return 0;
}


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

long long int n, m, a, b, k;
bool arr[MAXN][MAXN];

int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    arr[i][i] = 1;
  }
  for (int i = 1; i <= m; i++) {
    cin >> a >> b;
    if (b > a) swap(a, b);
    arr[a][n+i] = 1;
    arr[b][n+i] = 1;
  }
  for (int i = 1;i <= n; i++) {
    k = 0;
    for (int j = 1; j <= n+m; j++) {
      if (arr[i][j]) k++;
    }
    cout << k << endl;
    for (int j = 1; j <= n+m; j++) {
      if (arr[i][j]) cout << i << " " << j << endl;
    }
  }
  return 0;
}


#include <bits/stdc++.h>
#define MAXN 100+5
using namespace std;

long long int n, m, a, b, k;
bool arr[MAXN][MAXN];

int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    arr[i][i] = 1;
  }
  for (int i = 0; i < m; i++) {
    cin >> a >> b;
    arr[a][b] = 1;
  }
  for (int i = 1;i <= n; i++) {
    k = 0;
    for (int j = 1; j <= n; j++) {
      if (arr[i][j]) k++;
    }
    cout << k << endl;
    for (int j = 1; j <= n; j++) {
      if (arr[i][j]) cout << i << " " << j << endl;
    }
  }
  return 0;
}


#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;
int n,m,a[2000],b[2000],x[2000],y[2000],cnt=0,cntx[2000],fir[2000],nxt[2000];
void addpo(int xi,int yi,int co){
    ++cnt;
    x[cnt]=xi;
    y[cnt]=yi;
    cntx[co]++;
    nxt[cnt]=fir[co];
    fir[co]=cnt;
}
int main(){
    scanf("%d %d",&n,&m);
    for(int i=1;i<=m;i++)
        scanf("%d %d",&a[i],&b[i]);
    for(int i=1;i<=n;i++)
        addpo(i,i,i);
    for(int i=1;i<=m;i++)
        addpo(a[i],b[i],b[i]);
    for(int i=1;i<=n;i++){
        printf("%d\n",cntx[i]);
        for(int j=fir[i];j;j=nxt[j])
            printf("%d %d\n",x[j],y[j]);
    }
    return 0;
}


#include <cstdio>
#include <algorithm>
#include <cstring>
#include <set>
using namespace std;
int n,m,a[20000],b[20000],x[20000],y[20000],cnt=0,cntx[20000],fir[20000],nxt[20000],pos;
void addpo(int xi,int yi,int co){
    ++cnt;
    x[cnt]=xi;
    y[cnt]=yi;
    cntx[co]++;
    nxt[cnt]=fir[co];
    fir[co]=cnt;
}
int main(){
    scanf("%d %d",&n,&m);
    for(int i=1;i<=m;i++)
        scanf("%d %d",&a[i],&b[i]);
    pos=n+2;
    for(int i=1;i<=n;i++)
        addpo(i,i,i);
    for(int i=1;i<=m;i++){
        addpo(pos,b[i],b[i]);
        addpo(pos,a[i],a[i]);
        pos+=2;
    }
    for(int i=1;i<=n;i++){
        printf("%d\n",cntx[i]);
        for(int j=fir[i];j;j=nxt[j])
            printf("%d %d\n",x[j],y[j]);
    }
    return 0;
}


#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;
int n,m,a[20000],b[20000],x[20000],y[20000],cnt=0,cntx[20000],fir[20000],nxt[20000],pos;
void addpo(int xi,int yi,int co){
    ++cnt;
    x[cnt]=xi;
    y[cnt]=yi;
    cntx[co]++;
    nxt[cnt]=fir[co];
    fir[co]=cnt;
}
int main(){
    scanf("%d %d",&n,&m);
    for(int i=1;i<=m;i++)
        scanf("%d %d",&a[i],&b[i]);
    pos=n+2;
    for(int i=1;i<=n;i++)
        addpo(i,i,i);
    for(int i=1;i<=m;i++){
        addpo(pos,b[i],b[i]);
        addpo(pos,a[i],a[i]);
        pos+=2;
    }
    for(int i=1;i<=n;i++){
        printf("%d\n",cntx[i]);
        for(int j=fir[i];j;j=nxt[j])
            printf("%d %d\n",x[j],y[j]);
    }
    return 0;
}


#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;
int n,m,a[2000],b[2000],x[2000],y[2000],cnt=0,cntx[2000],fir[2000],nxt[2000],pos;
void addpo(int xi,int yi,int co){
    ++cnt;
    x[cnt]=xi;
    y[cnt]=yi;
    cntx[co]++;
    nxt[cnt]=fir[co];
    fir[co]=cnt;
}
int main(){
    scanf("%d %d",&n,&m);
    for(int i=1;i<=m;i++)
        scanf("%d %d",&a[i],&b[i]);
    pos=n+2;
    for(int i=1;i<=n;i++)
        addpo(i,i,i);
    for(int i=1;i<=m;i++){
        addpo(pos,b[i],b[i]);
        addpo(pos,a[i],a[i]);
        pos+=2;
    }
    for(int i=1;i<=n;i++){
        printf("%d\n",cntx[i]);
        for(int j=fir[i];j;j=nxt[j])
            printf("%d %d\n",x[j],y[j]);
    }
    return 0;
}


#include <cstdio>
#include <algorithm>
#include <cstring>
#include <set>
using namespace std;
int n,m,a[20000],b[20000],x[20000],y[20000],cnt=0,cntx[20000],fir[20000],nxt[20000],pos;
void addpo(int xi,int yi,int co){
    ++cnt;
    x[cnt]=xi;
    y[cnt]=yi;
    cntx[co]++;
    nxt[cnt]=fir[co];
    fir[co]=cnt;
}
int main(){
    scanf("%d %d",&n,&m);
    for(int i=1;i<=m;i++)
        scanf("%d %d",&a[i],&b[i]);
    pos=n+1;
    for(int i=1;i<=n;i++)
        addpo(i,i,i);
    for(int i=1;i<=m;i++){
        addpo(pos,b[i],b[i]);
        addpo(pos,a[i],a[i]);
        pos+=1;
    }
    for(int i=1;i<=n;i++){
        printf("%d\n",cntx[i]);
        for(int j=fir[i];j;j=nxt[j])
            printf("%d %d\n",x[j],y[j]);
    }
    return 0;
}


#include<bits/stdc++.h>

#define pb push_back
#define Pb pop_back

#define PI acos(-1.00)
#define pii pair<int,int>
#define ppi pair<pii,int>
#define INTMAX 1<<30
#define MOD 1000000007

#define LL long long
#define LLU unsigned long long

#define fs first
#define sc second

using namespace std;
int root[1000];
int Find(int x){
    if(root[x]==x) return x;
    return root[x]=Find(root[x]);
}
int main()
{
    ios_base::sync_with_stdio(false);
    int t,test=1;
    int n,m;
    cin>>n>>m;
    //for(int i=1;i<=n;i++) root[i]=i;
    vector<pii>v[n+1];
    for(int i=1;i<=m;i++)
    {
        int x,y;
        cin>>x>>y;
        v[x].pb(pii(x,i));
        v[y].pb(pii(y,i));
    }
    for(int i=1;i<=n;i++)
    {
        if(v[i].empty()) continue;
        cout<<v[i].size()<<endl;
        for(int j=0;j<v[i].size();j++)
        {
            cout<<v[i][j].fs<<" "<<v[i][j].sc<<endl;
        }
    }
    return 0;
}


#include<bits/stdc++.h>

#define pb push_back
#define Pb pop_back

#define PI acos(-1.00)
#define pii pair<int,int>
#define ppi pair<pii,int>
#define INTMAX 1<<30
#define MOD 1000000007

#define LL long long
#define LLU unsigned long long

#define fs first
#define sc second

using namespace std;
int root[1000];
int Find(int x){
    if(root[x]==x) return x;
    return root[x]=Find(root[x]);
}
int main()
{
    ios_base::sync_with_stdio(false);
    int t,test=1;
    int n,m;
    cin>>n>>m;
    //for(int i=1;i<=n;i++) root[i]=i;
    vector<pii>v[n+1];
    for(int i=1;i<=m;i++)
    {
        int x,y;
        cin>>x>>y;
        v[x].pb(pii(x,i));
        v[y].pb(pii(y,i));
    }
    for(int i=1,col=m+1;i<=n;i++)
    {
        if(v[i].empty()) {
            cout<<1<<endl;
            cout<<i<<" "<<col++<<endl;
            continue;
        }
        cout<<v[i].size()<<endl;
        for(int j=0;j<v[i].size();j++)
        {
            cout<<v[i][j].fs<<" "<<v[i][j].sc<<endl;
        }
    }
    return 0;
}


#include<bits/stdc++.h>

#define pb push_back
#define Pb pop_back

#define PI acos(-1.00)
#define pii pair<int,int>
#define ppi pair<pii,int>
#define INTMAX 1<<30
#define MOD 1000000007

#define LL long long
#define LLU unsigned long long

#define fs first
#define sc second

using namespace std;
int root[1000];
int Find(int x){
    if(root[x]==x) return x;
    return root[x]=Find(root[x]);
}
int main()
{
    ios_base::sync_with_stdio(false);
    int t,test=1;
    int n,m;
    cin>>n>>m;
    //for(int i=1;i<=n;i++) root[i]=i;
    vector<pii>v[n+1];
    for(int i=1;i<=m;i++)
    {
        int x,y;
        cin>>x>>y;
        v[x].pb(pii(x,i));
        v[y].pb(pii(y,i));
    }
    for(int i=1;i<=n;i++)
    {
        if(v[i].empty()) continue;
        cout<<v[i].size()<<endl;
        for(int j=0;j<v[i].size();j++)
        {
            cout<<v[i][j].fs<<" "<<v[i][j].sc<<endl;
        }
    }
    for(int i=1,col=m+1;i<=n;i++,col++)
    {
        if(!v[i].empty()) continue;
        cout<<1<<endl;
        cout<<i<<" "<<col<<endl;
    }
    return 0;
}


#include<bits/stdc++.h>

#define pb push_back
#define Pb pop_back

#define PI acos(-1.00)
#define pii pair<int,int>
#define ppi pair<pii,int>
#define INTMAX 1<<30
#define MOD 1000000007

#define LL long long
#define LLU unsigned long long

#define fs first
#define sc second

using namespace std;
int root[1000];
int Find(int x){
    if(root[x]==x) return x;
    return root[x]=Find(root[x]);
}
int main()
{
    ios_base::sync_with_stdio(false);
    int t,test=1;
    int n,m;
    cin>>n>>m;
    for(int i=1;i<=n;i++) root[i]=i;
    for(int i=0;i<m;i++)
    {
        int x,y;
        cin>>x>>y;
        x=Find(x);
        y=Find(y);
        root[x]=y;
    }
    vector<int>v[n+2];
    vector<pii>p(n+1);
    for(int i=1;i<=n;i++) v[Find(i)].pb(i);
    int col=1;
    for(int i=1;i<=n;i++)
    {
        for(int j=0;j<v[i].size();j++)
        {
            int k=v[i][j];
            p[k]=pii(i,col++);
        }
    }
    for(int i=1;i<=n;i++){
        cout<<1<<endl;
        cout<<p[i].fs<<" "<<p[i].sc<<endl;
    }
    return 0;
}


#include<bits/stdc++.h>
#define debug(x) cout << "[" << #x <<": " << (x) <<"]"<< endl
#define pii pair<int,int>
#define clr(a,b) memset((a),b,sizeof(a))
#define rep(i,a,b) for(int i = a;i < b;i ++)
#define pb push_back
#define MP make_pair
#define LL long long
#define INT(t) int t; scanf("%d",&t)
#define LLI(t) LL t; scanf("%I64d",&t)

using namespace std;

int main()
{
    int n,m;
    while(~scanf("%d%d",&n,&m)){
        vector<int> v[110];
        for(int i = 1;i <= n;i ++)
            v[i].pb(i);
        int x,y;
        int coun = n + 1;
        for(int i = 0;i < m;i ++){
            scanf("%d%d",&x,&y);
            v[x].pb(coun);
            v[y].pb(coun);
            coun ++;
        }
        for(int i = 1;i <= n;i ++){
            printf("%d\n",v[i].size());
            for(int j = 0;j < v[i].size();j ++)
                printf("%d %d\n",i,v[i][j]);
        }
    }
    return 0;
}


#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <bitset>
#include <iostream>
#include <vector>
typedef long long ll;
using namespace std;
const int maxn=110;
int l,r;
int n,m;
struct node{
    int x,y;
    node(int a,int b):x(a),y(b){};
};
vector<node> vec[maxn];
vector<int> G[maxn];

int main(){
    scanf("%d%d",&n,&m);
    for(int i=1;i<=m;i++){
        int u,v;
        scanf("%d%d",&u,&v);
        G[u].push_back(v);
    }
    l=1,r=1;//行， 列
    for(int i=1;i<=n;i++){
        if(G[i].size()==0) continue;
        vec[i].push_back(node(l,r));
        r++;
        for(int j=0;j<G[i].size();j++){
            int v=G[i][j];
            vec[v].push_back(node(l,r+j));
        }
        r+=G[i].size();
        l++;
        for(int j=0;j<G[i].size();j++){
            int v=G[i][j];
            vec[v].push_back(node(l+j,r));
        }
        l+=G[i].size();
        vec[i].push_back(node(l,r));
        l++;
        r++;
    }
    for(int i=1;i<=n;i++){
        if(vec[i].size()!=0) printf("%d\n",vec[i].size());
        for(int j=0;j<vec[i].size();j++){
            printf("%d %d\n",vec[i][j].x,vec[i][j].y);
        }
    }
    return 0;
}


#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <bitset>
#include <iostream>
#include <vector>
typedef long long ll;
using namespace std;
const int maxn=110;
int l,r;
int n,m;
struct node{
    int x,y;
    node(int a,int b):x(a),y(b){};
};
vector<node> vec[maxn];
vector<int> G[maxn];

int main(){
    scanf("%d%d",&n,&m);
    for(int i=1;i<=m;i++){
        int u,v;
        scanf("%d%d",&u,&v);
        G[u].push_back(v);
    }
    l=1,r=1;//行， 列
    for(int i=1;i<=n;i++){
        if(G[i].size()==0) continue;
        vec[i].push_back(node(l,r));
        r++;
        for(int j=0;j<G[i].size();j++){
            int v=G[i][j];
            vec[v].push_back(node(l,r+j));
        }
        r+=G[i].size();
        l++;
        l++,r++;
    }
    for(int i=1;i<=n;i++){
        if(vec[i].size()!=0) printf("%d\n",vec[i].size());
        for(int j=0;j<vec[i].size();j++){
            printf("%d %d\n",vec[i][j].x,vec[i][j].y);
        }
    }
    return 0;
}


#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <bitset>
#include <iostream>
#include <vector>
typedef long long ll;
using namespace std;
const int maxn=110;
int l,r;
int n,m;
struct node{
    int x,y;
    node(int a,int b):x(a),y(b){};
};
vector<node> vec[maxn];
vector<int> G[maxn];

int main(){
    scanf("%d%d",&n,&m);
    for(int i=1;i<=m;i++){
        int u,v;
        scanf("%d%d",&u,&v);
        G[u].push_back(v);
        G[v].push_back(u);
    }
    l=1,r=1;//行， 列
    for(int i=1;i<=n;i++){
        for(int j=0;j<G[i].size();j++){
            int v=G[i][j];
            vec[v].push_back(node(l,r+j));
        }
        r+=G[i].size();
        l++;
        for(int j=0;j<G[i].size();j++){
            int v=G[i][j];
            vec[v].push_back(node(l+j,r));
        }
        l+=G[i].size();
        r++;
    }
    for(int i=1;i<=n;i++){
        if(vec[i].size()!=0) printf("%d\n",vec[i].size());
        for(int j=0;j<vec[i].size();j++){
            printf("%d %d\n",vec[i][j].x,vec[i][j].y);
        }
    }
    return 0;
}


#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <bitset>
#include <iostream>
#include <vector>
typedef long long ll;
using namespace std;
const int maxn=110;
int l,r;
int n,m;
struct node{
    int x,y;
    node(int a,int b):x(a),y(b){};
};
vector<node> vec[maxn];
vector<int> G[maxn];

int main(){
    scanf("%d%d",&n,&m);
    for(int i=1;i<=m;i++){
        int u,v;
        scanf("%d%d",&u,&v);
        G[u].push_back(v);
        G[v].push_back(u);
    }
    l=1,r=1;//行， 列
    for(int i=1;i<=n;i++){
        vec[i].push_back(node(l,r+1));
        r++;
        for(int j=0;j<G[i].size();j++){
            int v=G[i][j];
            vec[v].push_back(node(l,r+j));
        }
        r+=G[i].size();
        l++;
        for(int j=0;j<G[i].size();j++){
            int v=G[i][j];
            vec[v].push_back(node(l+j,r));
        }
        l+=G[i].size();
        vec[i].push_back(node(l+1,r));
        l++;
        r++;
    }
    for(int i=1;i<=n;i++){
        if(vec[i].size()!=0) printf("%d\n",vec[i].size());
        for(int j=0;j<vec[i].size();j++){
            printf("%d %d\n",vec[i][j].x,vec[i][j].y);
        }
    }
    return 0;
}


#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <bitset>
#include <iostream>
#include <vector>
typedef long long ll;
using namespace std;
const int maxn=110;
int l,r;
int n,m;
struct node{
    int x,y;
    node(int a,int b):x(a),y(b){};
};
vector<node> vec[maxn];
vector<int> G[maxn];

int main(){
    scanf("%d%d",&n,&m);
    for(int i=1;i<=m;i++){
        int u,v;
        scanf("%d%d",&u,&v);
        G[u].push_back(v);
    }
    l=1,r=1;//行， 列
    for(int i=1;i<=n;i++){
        if(G[i].size()==0) continue;
        vec[i].push_back(node(l,r));
        r++;
        for(int j=0;j<G[i].size();j++){
            int v=G[i][j];
            vec[v].push_back(node(l,r+j));
        }
        r+=G[i].size();
        l++;
        l+=2,r+=2;
    }
    for(int i=1;i<=n;i++){
        if(vec[i].size()!=0) printf("%d\n",vec[i].size());
        for(int j=0;j<vec[i].size();j++){
            printf("%d %d\n",vec[i][j].x,vec[i][j].y);
        }
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
const MAX = 100000000;

vector<int> a[MAX][MAX];
vector<int> adj[6000];
int n, m;

int start_x = 0;
int start_y = 0;

void dfs() {

}

int main() {
    cin >> n >> m;

    while (m--) {
        int i,j;
        cin >> i >> j;

        adj[i].push_back(m + j);
        adj[j].push_back(m + i);
    }

    for (int i = 1; i <= n; i++) {
        cout << i << endl;
        cout << i << " " << i << endl;
        for (auto x: adj[i]) {
            cout << i << " " << x << endl;
        }

    }

    return 0;
}


#include <iostream>
#include <vector>

using namespace std;

int n, m;
vector<int> adj[7000];

int main() {
    cin >> n >> m;

    for (int k = 1; k <= m; k++) {
        int i,j;
        cin >> i >> j;

        adj[i].push_back(n + k);
        adj[j].push_back(n + k);
    }

    for (int i = 1; i <= n; i++) {
        cout << i << endl;
        cout << i << " " << i << endl;
        for (auto x: adj[i]) {
            cout << i << " " << x << endl;
        }

    }

    return 0;
}


#include <iostream>
#include <vector>

using namespace std;

int n, m;
vector<int> adj[7000];

int main() {
    cin >> n >> m;

    for (int k = 1; k <= m; k++) {
        int i,j;
        cin >> i >> j;

        adj[i].push_back(n + k);
        adj[j].push_back(n + k);
    }

    for (int i = 1; i <= n; i++) {
        cout << adj[i].size() + 1 << endl;
        cout << i << " " << i << endl;
        for (auto x: adj[i]) {
            cout << i << " " << x << endl;
        }

    }

    return 0;
}


#include <iostream>
#include <vector>

using namespace std;

int n, m;
vector<int> adj[7000];

int main() {
    cin >> n >> m;

    while (m--) {
        int i,j;
        cin >> i >> j;

        adj[i].push_back(m + j);
        adj[j].push_back(m + i);
    }

    for (int i = 1; i <= n; i++) {
        cout << i << endl;
        cout << i << " " << i << endl;
        for (auto x: adj[i]) {
            cout << i << " " << x << endl;
        }

    }

    return 0;
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int maxn=50050;
int a[maxn];
struct Ans{int x,y;}ans[100][5050];
int n,m,f[110][110],vis[110];
int main()
{
  	scanf("%d%d",&n,&m);
	for(int i=1,l,r;i<=m;i++)
		scanf("%d%d",&l,&r),f[l][r]=f[r][l]=1;
	int now=0;
 	for(int i=1;i<=n;i++)
	{
		for(int j=i+1;j<=n;j++)
		if(f[i][j])
		{
			ans[i][++a[i]].x=i,ans[i][a[i]].y=++now;
			ans[j][++a[j]].x=j,ans[j][a[j]].y=now;
			vis[j]=1;
			vis[i]=1;
			f[i][j]=0;
		}
	}
	for(int i=1;i<=n;i++)
		if(!vis[i])
			ans[i][++a[i]].x=i,ans[i][a[i]].y=++now;
	for(int i=1;i<=n;i++)
	{
		if(!a[i])continue;
		printf("%d\n",a[i]);
		for(int j=1;j<=a[i];j++)
		printf("%d %d\n",ans[i][j].x,ans[i][j].y);
	}
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int maxn=50050;
int a[maxn];
struct Ans{int x,y;}ans[110][50050];
int n,m,f[110][110],vis[110];
int main()
{
  	scanf("%d%d",&n,&m);
	for(int i=1,l,r;i<=m;i++)
		scanf("%d%d",&l,&r),f[l][r]=1;
	int now=0;
 	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=n;j++)
		if(f[i][j])
		{
			ans[i][++a[i]].x=i,ans[i][a[i]].y=++now;
			ans[j][++a[j]].x=j,ans[j][a[j]].y=now;
			vis[j]=1;
			vis[i]=1;
			f[i][j]=f[j][i]=0;
		}
	}
	for(int i=1;i<=n;i++)
		if(!vis[i])
			ans[i][++a[i]].x=i,ans[i][a[i]].y=++now;
	for(int i=1;i<=n;i++)
	{
		printf("%d\n",a[i]);
		for(int j=1;j<=a[i];j++)
		printf("%d %d\n",ans[i][j].y,ans[i][j].x);
	}
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int maxn=50050;
int a[maxn];
struct Ans{int x,y;}ans[100][50050];
int n,m,f[110][110],vis[110];
int main()
{
  	scanf("%d%d",&n,&m);
	for(int i=1,l,r;i<=m;i++)
		scanf("%d%d",&l,&r),f[l][r]=f[r][l]=1;
	int now=0;
 	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=n;j++)
		if(f[i][j])
		{
			ans[i][++a[i]].x=i,ans[i][a[i]].y=++now;
			ans[j][++a[j]].x=j,ans[j][a[j]].y=now;
			vis[j]=1;
			vis[i]=1;
			f[i][j]=f[j][i]=0;
		}
	}
	for(int i=1;i<=n;i++)
		if(!vis[i])
			ans[i][++a[i]].x=i,ans[i][a[i]].y=++now;
	for(int i=1;i<=n;i++)
	{
		if(!a[i])continue;
		printf("%d\n",a[i]);
		for(int j=1;j<=a[i];j++)
		printf("%d %d\n",ans[i][j].y,ans[i][j].x);
	}
}


#include<bits/stdc++.h>

#define ms(a,x) memset(a,x,sizeof(a))
using namespace std;

#define N 110
#define MAX 2000000

typedef long long ll;

int main(){
	int n;
	double a,b;
	cin>>n>>a>>b;
	double sum=0;
	double x[N];
	for(int i=0;i<n;i++){
		cin>>x[i];
		sum+=x[i];
	}
	sort(x+1,x+n);
	for(int i=1;i<=n;i++){
		if(a*(double)x[0]/sum>=b){
			cout<<i-1<<endl;
			return 0;
		}
		sum-=x[i];
	}
	return 0;
}


#include<bits/stdc++.h>

#define ms(a,x) memset(a,x,sizeof(a))
using namespace std;

#define N 110
#define MAX 2000000

typedef long long ll;

int main(){
	int n;
	double a,b;
	cin>>n>>a>>b;
	double sum=0;
	double x[N];
	for(int i=0;i<n;i++){
		cin>>x[i];
		sum+=x[i];
	}
	//cout<<sum<<endl;
	sort(x+1,x+n);
	for(int i=n-1;i>0;i--){
		//cout<<a<<' '<<sum<<' '<<a*x[0]/sum<<endl;
		if(a*x[0]/sum>=b){

			cout<<n-i-1<<endl;
			return 0;
		}
		sum-=x[i];
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ub upper_bound
#define int long long
#define vbe(sdk) sdk.begin(), sdk.end()
#define pb push_back
#define loop(i, a, b) for (int i = a; i < b; ++i)
#define rloop(i, a, b) for (int i = a; i >= b; --i)
#define mp make_pair
#define mod 1000000007
#define endl '\n'
#define vvll vector<vector<int>>
#define vll vector<int>
#define mint map<int, int>
#define arry(x) (int)x.size()
#define sll set<int>
#define pll pair<int, int>
#define F first
#define S second
#define pi 3.14159265358979323846
using namespace std;
const int MAX = 100001;

void solve()
{
        int n;
        int a,b;
        cin>>n>>a>>b;
        int v[n];
        int cnt=0;
        loop(i,0,n)
        {
            cin>>v[i];
        }
        sort(v+1,v+n);
         loop(i,0,n)
        {
            v[i]+=cnt;
            cnt=v[i];
        }
        // loop(i,0,n)
        // {
        //     cout<<v[i]<<" ";
        // }
        // cout<<"\n";
         double ans=v[0]*a;
        loop(i,1,n)
        {
            // cout<<"sum "<<v[n-1]-v[i]+v[0]<<"\n";
          if(ans <= b*(v[i]))
          {
              cout<<n-i<<"\n";
              return;
          }
        }

        cout<<0<<"\n";
        return;

}
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    // #ifndef ONLINE_JUDGE
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    // #else
    // // online submission
    // #endif

    int t = 1;
    //    cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ub upper_bound
#define int long long
#define vbe(sdk) sdk.begin(), sdk.end()
#define pb push_back
#define loop(i, a, b) for (int i = a; i < b; ++i)
#define rloop(i, a, b) for (int i = a; i >= b; --i)
#define mp make_pair
#define mod 1000000007
#define endl '\n'
#define vvll vector<vector<int>>
#define vll vector<int>
#define mint map<int, int>
#define arry(x) (int)x.size()
#define sll set<int>
#define pll pair<int, int>
#define F first
#define S second
#define pi 3.14159265358979323846
using namespace std;
const int MAX = 100001;

void solve()
{
        int n;
        double a,b;
        cin>>n>>a>>b;
        double v[n];
        int cnt=0;
        loop(i,0,n)
        {
            cin>>v[i];
            v[i]+=cnt;
            cnt=v[i];
        }
        sort(v+1,v+n,greater<int>());
        // loop(i,0,n)
        // {
        //     cout<<v[i]<<" ";
        // }
        // cout<<"\n";
         double ans=v[0]*a;
         if(ans/(v[1]) >=b )
         {
             cout<<"0";
             return;
         }
        loop(i,1,n)
        {
            // cout<<"sum "<<v[n-1]-v[i]+v[0]<<"\n";
          if((ans/(v[i+1])) >= b)
          {
              cout<<i<<"\n";
              return;
          }
        }

}
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    // #ifndef ONLINE_JUDGE
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    // #else
    // // online submission
    // #endif

    int t = 1;
    //    cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ub upper_bound
#define int long long
#define vbe(sdk) sdk.begin(), sdk.end()
#define pb push_back
#define loop(i, a, b) for (int i = a; i < b; ++i)
#define rloop(i, a, b) for (int i = a; i >= b; --i)
#define mp make_pair
#define mod 1000000007
#define endl '\n'
#define vvll vector<vector<int>>
#define vll vector<int>
#define mint map<int, int>
#define arry(x) (int)x.size()
#define sll set<int>
#define pll pair<int, int>
#define F first
#define S second
#define pi 3.14159265358979323846
using namespace std;
const int MAX = 100001;

void solve()
{
        int n;
        int a,b;
        cin>>n>>a>>b;
        int v[n];
        int cnt=0;
        loop(i,0,n)
        {
            cin>>v[i];
        }
        sort(v+1,v+n);
         loop(i,0,n)
        {
            v[i]+=cnt;
            cnt=v[i];
        }
        // loop(i,0,n)
        // {
        //     cout<<v[i]<<" ";
        // }
        // cout<<"\n";
         double ans=v[0]*a;
        loop(i,1,n)
        {
            // cout<<"sum "<<v[n-1]-v[i]+v[0]<<"\n";
          if(ans < b*(v[i]))
          {
              cout<<n-i<<"\n";
              return;
          }
        }

        cout<<0<<"\n";
        return;

}
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    // #ifndef ONLINE_JUDGE
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    // #else
    // // online submission
    // #endif

    int t = 1;
    //    cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ub upper_bound
#define int long long
#define vbe(sdk) sdk.begin(), sdk.end()
#define pb push_back
#define loop(i, a, b) for (int i = a; i < b; ++i)
#define rloop(i, a, b) for (int i = a; i >= b; --i)
#define mp make_pair
#define mod 1000000007
#define endl '\n'
#define vvll vector<vector<int>>
#define vll vector<int>
#define mint map<int, int>
#define arry(x) (int)x.size()
#define sll set<int>
#define pll pair<int, int>
#define F first
#define S second
#define pi 3.14159265358979323846
using namespace std;
const int MAX = 100001;

void solve()
{
        int n;
        double a,b;
        cin>>n>>a>>b;
        double v[n];
        int cnt=0;
        loop(i,0,n)
        {
            cin>>v[i];
            v[i]+=cnt;
            cnt=v[i];
        }
        sort(v+1,v+n);
         double ans=v[0]*a;
         if(ans/(v[n-1]) >=b )
         {
             cout<<"0";
             return;
         }
        loop(i,1,n)
        {
            // cout<<"sum "<<v[n-1]-v[i]+v[0]<<"\n";
          if((ans/(v[n-1]-v[i]+v[0])) >= b)
          {
              cout<<i<<"\n";
              return;
          }
        }

}
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    // #ifndef ONLINE_JUDGE
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    // #else
    // // online submission
    // #endif

    int t = 1;
    //    cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ub upper_bound
#define int long long
#define vbe(sdk) sdk.begin(), sdk.end()
#define pb push_back
#define loop(i, a, b) for (int i = a; i < b; ++i)
#define rloop(i, a, b) for (int i = a; i >= b; --i)
#define mp make_pair
#define mod 1000000007
#define endl '\n'
#define vvll vector<vector<int>>
#define vll vector<int>
#define mint map<int, int>
#define arry(x) (int)x.size()
#define sll set<int>
#define pll pair<int, int>
#define F first
#define S second
#define pi 3.14159265358979323846
using namespace std;
const int MAX = 100001;

void solve()
{
        int n;
        double a,b;
        cin>>n>>a>>b;
        double v[n];
        int cnt=0;
        loop(i,0,n)
        {
            cin>>v[i];
            v[i]+=cnt;
            cnt=v[i];
        }
        sort(v+1,v+n,greater<int>());
        // loop(i,0,n)
        // {
        //     cout<<v[i]<<" ";
        // }
        // cout<<"\n";
         double ans=v[0]*a;
         if(ans/(v[1]) >=b )
         {
             cout<<"0";
             return;
         }
        loop(i,1,n)
        {
            // cout<<"sum "<<v[n-1]-v[i]+v[0]<<"\n";
          if((ans/(v[i+1])) >= b)
          {
              cout<<i<<"\n";
              return;
          }
        }

        cout<<n-1<<"\n";
        return;

}
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    // #ifndef ONLINE_JUDGE
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    // #else
    // // online submission
    // #endif

    int t = 1;
    //    cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ub upper_bound
#define int long long
#define vbe(sdk) sdk.begin(), sdk.end()
#define pb push_back
#define loop(i, a, b) for (int i = a; i < b; ++i)
#define rloop(i, a, b) for (int i = a; i >= b; --i)
#define mp make_pair
#define mod 1000000007
#define endl '\n'
#define vvll vector<vector<int>>
#define vll vector<int>
#define mint map<int, int>
#define arry(x) (int)x.size()
#define sll set<int>
#define pll pair<int, int>
#define F first
#define S second
#define pi 3.14159265358979323846
using namespace std;
const int MAX = 100001;

void solve()
{
        int n;
        double a,b;
        cin>>n>>a>>b;
        double v[n];
        int cnt=0;
        loop(i,0,n)
        {
            cin>>v[i];
            v[i]+=cnt;
            cnt=v[i];
        }
        sort(v,v+n);
         double ans=v[0]*a;
         if((v[0]*a)/(v[n-1]) >=b )
         {
             cout<<"0";
             return;
         }
        loop(i,1,n)
        {
          if((ans/(v[n-1]-v[i]+v[0])) >= b)
          {
              cout<<i<<"\n";
              return;
          }
        }

}
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    // #ifndef ONLINE_JUDGE
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    // #else
    // // online submission
    // #endif

    int t = 1;
    //    cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ub upper_bound
#define int long long
#define vbe(sdk) sdk.begin(), sdk.end()
#define pb push_back
#define loop(i, a, b) for (int i = a; i < b; ++i)
#define rloop(i, a, b) for (int i = a; i >= b; --i)
#define mp make_pair
#define mod 1000000007
#define endl '\n'
#define vvll vector<vector<int>>
#define vll vector<int>
#define mint map<int, int>
#define arry(x) (int)x.size()
#define sll set<int>
#define pll pair<int, int>
#define F first
#define S second
#define pi 3.14159265358979323846
using namespace std;
const int MAX = 100001;

void solve()
{
        int n;
        double a,b;
        cin>>n>>a>>b;
        double v[n];
        int cnt=0;
        loop(i,0,n)
        {
            cin>>v[i];
            v[i]+=cnt;
            cnt=v[i];
        }
        sort(v+1,v+n,greater<int>());
        // loop(i,0,n)
        // {
        //     cout<<v[i]<<" ";
        // }
        // cout<<"\n";
         double ans=v[0]*a;
         if(ans/(v[1]) >=b )
         {
             cout<<"0";
             return;
         }
        loop(i,1,n-1)
        {
            // cout<<"sum "<<v[n-1]-v[i]+v[0]<<"\n";
          if((ans/(v[i+1])) >= b)
          {
              cout<<i<<"\n";
              return;
          }
        }

        cout<<n-1<<"\n";
        return;

}
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    // #ifndef ONLINE_JUDGE
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    // #else
    // // online submission
    // #endif

    int t = 1;
    //    cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ub upper_bound
#define int long long
#define vbe(sdk) sdk.begin(), sdk.end()
#define pb push_back
#define loop(i, a, b) for (int i = a; i < b; ++i)
#define rloop(i, a, b) for (int i = a; i >= b; --i)
#define mp make_pair
#define mod 1000000007
#define endl '\n'
#define vvll vector<vector<int>>
#define vll vector<int>
#define mint map<int, int>
#define arry(x) (int)x.size()
#define sll set<int>
#define pll pair<int, int>
#define F first
#define S second
#define pi 3.14159265358979323846
using namespace std;
const int MAX = 100001;

void solve()
{
        int n;
        int a,b;
        cin>>n>>a>>b;
        int v[n];
        int cnt=0;
        loop(i,0,n)
        {
            cin>>v[i];
        }
        sort(v+1,v+n);
         loop(i,0,n)
        {
            v[i]+=cnt;
            cnt=v[i];
        }
        // loop(i,0,n)
        // {
        //     cout<<v[i]<<" ";
        // }
        // cout<<"\n";
         double ans=v[0]*a;
        loop(i,1,n)
        {
            // cout<<"sum "<<v[n-1]-v[i]+v[0]<<"\n";
          if(ans >= b*(v[i]))
          {
              cout<<n-i-2<<"\n";
              return;
          }
        }

        cout<<n-1<<"\n";
        return;

}
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    // #ifndef ONLINE_JUDGE
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    // #else
    // // online submission
    // #endif

    int t = 1;
    //    cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
   int n,a,b,i,hole[10000],s=0;
   scanf("%d%d%d",&n,&a,&b);
   for(i=0;i<n;i++)
      scanf("%d",&hole[i]);
   for(sort(hole,hole+n),i=0;i<n;i++){
           s+=hole[i];
           int temp=(a*hole[0]/s);
           if(temp<b) break;
   }
   printf("%d",n-i);
}


#include<bits/stdc++.h>
using namespace std;
int hole[1000000];
int main(){
   int n,a,b,i,,s=0;
   scanf("%d%d%d",&n,&a,&b);
   for(i=0;i<n;i++)
      scanf("%d",&hole[i]);
   for(sort(hole+1,hole+n),i=0;i<n;i++){
           s+=hole[i];
           int temp=(a*hole[0]/s);
           if(temp<b) break;
   }
   printf("%d",n-i);
}


#include<bits/stdc++.h>
using namespace std;
int main(){
   int n,a,b,i,hole[10000],s=0;
   scanf("%d%d%d",&n,&a,&b);
   for(i=0;i<n;i++)
      scanf("%d",&hole[i]);
   for(sort(hole+1,hole+n),i=0;i<n;i++){
           s+=hole[i];
           int temp=(a*hole[0]/s);
           if(temp<b) break;
   }
   printf("%d",n-i);
}


#include<bits/stdc++.h>
using namespace std;
int hole[1000000];
int main(){
   int n,a,b,i,s=0;
   scanf("%d%d%d",&n,&a,&b);
   for(i=0;i<n;i++)
      scanf("%d",&hole[i]);
   for(sort(hole+1,hole+n),i=0;i<n;i++){
           s+=hole[i];
           int temp=(a*hole[0]/s);
           if(temp<b) break;
   }
   printf("%d",n-i);
}


#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int maxn = 1e5 + 5;
int s[maxn];
int cnt[maxn];
bool used[maxn];
int main()
{
    int n;
    ll a,b;
    cin>>n>>a>>b;
    ll sum = 0;
    for(int i = 1;i<=n;i++)
    {
        cnt[i] = i;
        cin>>s[i];
        sum += s[i];
    }
    //sort(s,s+n);
    sort(cnt+1,cnt+n+1,[](int x,int y){return s[x] > s[y];});
    if(b * sum <= a*s[1])
    {
        return cout<<0<<endl,0;
    }
    for(int i = 1;i<n;i++)
    {
        int t = cnt[i];
        sum -= s[t];
        used[i] = 1;
        int first = 1;
        while(used[first]) first++;
        if(b * sum <= a * s[first])
        {
            cout<<i<<endl;
            return 0;
        }
    }
    cout<<n-1<<endl;
    return 0;
}


#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int maxn = 1e5 + 5;
int s[maxn];
int main()
{
    int n;
    double a,b;
    cin>>n>>a>>b;
    ll sum = 0;
    for(int i = 0;i<n;i++)
    {
        cin>>s[i];
        sum += s[i];
    }
    //sort(s,s+n);
    for(int i = 0;i<n;i++)
    {
        if(b * sum <= a * s[i])
        {
            cout<<i<<endl;
            break;
        }
        else sum -= s[i];
    }
    return 0;
}


#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int maxn = 1e5 + 5;
int s[maxn];
int cnt[maxn];
bool used[maxn];
int main()
{
    int n;
    ll a,b;
    cin>>n>>a>>b;
    ll sum = 0;
    for(int i = 1;i<=n;i++)
    {
        cnt[i] = i;
        cin>>s[i];
        sum += s[i];
    }
    //sort(s,s+n);
    sort(cnt+1,cnt+n+1,[](int x,int y){return s[x] > s[y];});
    if(b * sum <= a*s[1])
    {
        return cout<<0<<endl,0;
    }
    int first = 1;
    for(int i = 1;i<n;i++)
    {
        int t = cnt[i];
        sum -= s[t];
        used[t] = 1;
        while(first <= n && used[first]) first++;
        if(b * sum <= a * s[first])
        {
            cout<<i<<endl;
            return 0;
        }
    }
    cout<<n - 1<<endl;
    return 0;
}


#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int maxn = 1e5 + 5;
int s[maxn];
int cnt[maxn];
int main()
{
    int n;
    ll a,b;
    cin>>n>>a>>b;
    ll sum = 0;
    for(int i = 1;i<=n;i++)
    {
        cnt[i] = i;
        cin>>s[i];
        sum += s[i];
    }
    //sort(s,s+n);
    sort(cnt+1,cnt+n+1,[](int x,int y){return s[x] < s[y];});
    if(b * sum <= a*s[1])
    {
        return cout<<0<<endl,0;
    }
    for(int i = 1;i<n;i++)
    {
        int t = cnt[i];
        sum -= s[t];
        if(b * sum <= a * s[t])
        {
            cout<<i<<endl;
            return 0 ;
        }
    }
    cout<<n-1<<endl;
    return 0;
}


#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll s[100001];
int main()
{
    ll n,a,b;
    cin>>n>>a>>b;
    for(int i = 1;i<=n;i++)
    {
        cin>>s[i];
    }
    sort(s+2,s+n+1);
    ll sum = s[1];
    for(int i = 2;i<=n;i++)
    {
        sum += s[i];
        if(sum * b > s[1]*a)
        {
            cout<<n-i +1<<endl;
            return 0;
        }
    }
    cout<<0<<endl;
    return 0;
}


#include <iostream>
#include <queue>
#include <vector>
using namespace std;

int main()
{
    priority_queue<int> q;
    int n,A,B;
    double ratioo = 0;
    cin >> n >> A >> B;
    double AA = A;
    double saved=0;
    double sum=0;
    for(int i=0;i<n;i++){
        int x;
        cin >> x;
        if(i==0){
            saved = x;
        }
        sum += x;
        if(i!=0)
            q.push(x);
    }
    ratioo = (saved*A)/sum;
    int ans=0;
    while(ratioo < B){
        int rmove = q.top();
        sum -= rmove;
        q.pop();
        ratioo = (saved*A)/sum;
        ans++;
    }
    cout << ans << endl;
    return 0;
}


#include <iostream>
#include <queue>
#include <vector>
using namespace std;

int main()
{
    priority_queue<int, vector<int>, greater<int> > q;
    int n,A,B;
    double ratioo = 0;
    cin >> n >> A >> B;
    double AA = A;
    double saved=0;
    double sum=0;
    for(int i=0;i<n;i++){
        int x;
        cin >> x;
        if(i==0){
            saved = x;
        }
        sum += x;
        q.push(x);
    }
    ratioo = (saved*A)/sum;
    int ans=0;
    while(ratioo < B){
        int rmove = q.top();
        sum -= rmove;
        q.pop();
        if(q.empty()){
            cout << n;
            return 0;
        }
        ratioo = (saved*A)/sum;
        ans++;
    }
    cout << ans << endl;
    return 0;
}


#include <iostream>
#include <queue>
using namespace std;

int main()
{
    priority_queue<int, vector<int>, greater<int> > q;
    int n,A,B;
    double ratioo = 0;
    cin >> n >> A >> B;
    double AA = A;
    double saved=0;
    double sum=0;
    for(int i=0;i<n;i++){
        int x;
        cin >> x;
        if(i==0){
            saved = x;
        }
        sum += x;
        q.push(x);
    }
    ratioo = (saved*A)/sum;
    int ans=0;
    while(ratioo < B){
        int rmove = q.top();
        sum -= rmove;
        q.pop();
        if(q.empty()){
            cout << n;
        }
        ratioo = (saved*A)/sum;
        ans++;
    }
    cout << ans << endl;
    return 0;
}


#include <iostream>
#include <queue>
using namespace std;

int main()
{
    priority_queue<int, vector<int>, greater<int> > q;
    int n,A,B;
    double ratioo = 0;
    cin >> n >> A >> B;
    double AA = A;
    double saved=0;
    double sum=0;
    for(int i=0;i<n;i++){
        int x;
        cin >> x;
        if(i==0){
            saved = x;
        }
        sum += x;
        q.push(x);
    }
    ratioo = (saved*A)/sum;
    int ans=0;
    while(ratioo < B){
        int rmove = q.top();
        sum -= rmove;
        q.pop();
        ratioo = (saved*A)/sum;
        ans++;
    }
    cout << ans << endl;
    return 0;
}


#include <iostream>
#include <queue>
#include <vector>
using namespace std;

int main()
{
    priority_queue<int, vector<int>, greater<int> > q;
    int n,A,B;
    double ratioo = 0;
    cin >> n >> A >> B;
    double AA = A;
    double saved=0;
    double sum=0;
    for(int i=0;i<n;i++){
        int x;
        cin >> x;
        if(i==0){
            saved = x;
        }
        sum += x;
        q.push(x);
    }
    ratioo = (saved*A)/sum;
    int ans=0;
    while(ratioo < B){
        int rmove = q.top();
        sum -= rmove;
        q.pop();
        if(q.empty()){
            cout << n;
        }
        ratioo = (saved*A)/sum;
        ans++;
    }
    cout << ans << endl;
    return 0;
}