#include <cstdio>
#include <stdlib.h>
#include <time.h>
#include <algorithm>
#include <set>
using namespace std;
set< pair<int, int> > S;
set< pair<int, int> >::iterator it;

int n, m, s, d, t;

int main()
{
    srand(time(NULL));
    scanf("%d%d%d%d",&n,&m,&s,&d);
    freopen(".20.in","w",stdout);
    printf("%d %d\n%d %d\n", n, m, s, d);
    for(int i = 2 ; i <= n ; i++ )
        printf("%d %d %d\n", i/2, i, (rand()%100)+2), m--, S.insert(make_pair(i/2,i));
    while(m)
    {
        int a, b, t2;
        a = rand()%n+1, b = rand()%n+1;
        if( a > b ) t2 = a, a = b, b = t2;
        it = S.find(make_pair(a,b));
        if( it == S.end() ) m--, S.insert(make_pair(a,b)), printf("%d %d %d\n", a, b, (rand()%50)+2);
    }
}
