#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <time.h>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <unordered_set>
#include <map>
#include <cmath>
#include <queue>
#include <iomanip>
#include <bitset>
#include <stack>
#include <memory.h>
#include <list>
#include <numeric>
#include <functional>
#include <complex>
#include <cassert>
#include <regex>
#include <random>
#include <omp.h>
#include <fstream>
#include <cassert>
#include "testlib.h"

#define ll long long
#define ld long double
#define ull unsigned ll
#define mp(xx, yy) make_pair(xx, yy)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define pii pair<int,int> 
#define pll pair<ll, ll> 
#define vi vector<int>
#define vll vector<ll>
#define vpii vector<pii>
#define vpll vector<pll>
#define vvi vector<vector<int>>
#define vvll vector<vll>
#define forn(it,from,to) for(int (it)=from; (it)<to; (it)++)
//#define endl '\n'
using namespace std;
const int N = 100005;
const int mod = 1000000007;


int main(int argc, char** argv) {
	registerGen(argc, argv, 1);

	int mxN = opt<int>(1);
	int mxM = opt<int>(2);
	int mxV = opt<int>(3);
	int mxH = opt<int>(4);
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	cout.precision(20); cout.setf(ios::fixed);

	int n = rnd.next(1, mxN);
	int m = rnd.next(1, mxM);
	vi v(n);
	forn(i, 0, n) {
		v[i] = rnd.next(1, mxV);
	}
	vvi h(n, vi(m));
	forn(i, 0, n) {
		int cur_h = rnd.next(1, mxH);
		forn(j, 0, m) {
			h[i][j] = cur_h;
		}
	}

	cout << n << ' ' << m << '\n';
	forn(i, 0, n) {
		cout << v[i];
		if (i != n - 1) cout << ' ';
	}
	cout << '\n';

	forn(i, 0, n) {
		forn(j, 0, m) {
			cout << h[i][j];
			if (j != m - 1) cout << ' ';
		}
		cout << '\n';
	}

	return 0;
}