See the problem statement here: [http://codeforces.com/contest/921/problem/01](//codeforces.com/contest/921/problem/01).
none
none
#pragma comment(linker, "/STACK:1000000000")
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <cmath>
#include <string>
#include <cstring>
#include <cstdlib>
#include <set>
#include <map>
#include <queue>

#define mp make_pair
#define pii pair <int, int>
#define ll long long
#define pll pair <ll, ll>
#define ld long double

using namespace std;

int dx[4] = { -1, 0, 1, 0 };
int dy[4] = { 0, -1, 0, 1 };

int getid(int x, int y) {
	for (int i = 0; i < 4; i++) {
		if (dx[i] == x && dy[i] == y) {
			return i;
		}
	}

	throw 1;
}

const int maxn = 1010;

int tp[maxn][maxn][4];
bool key[maxn][maxn];
bool ex[maxn][maxn];

int cmp[maxn][maxn];
int num = 0;
vector <int> ed[maxn * maxn];
int cnt[maxn * maxn];
int num_of_ex[maxn * maxn];

int n, m;

inline void dfs(int x, int y, int cur) {
	cmp[x][y] = cur;
	
	if (key[x][y]) {
		cnt[cur]++;
	}

	if (ex[x][y]) {
		num_of_ex[cur]++;
	}

	for (int i = 0; i < 4; i++) {
		int nx = x + dx[i];
		int ny = y + dy[i];

		if (0 <= nx && nx < n && 0 <= ny && ny < m && tp[x][y][i] == 0 && cmp[nx][ny] == -1) {
			dfs(nx, ny, cur);
		}
	}
}

int dst[maxn][maxn];
int pr[maxn][maxn];

string get_str(int it) {
	if (it == 0) {
		return "move-up";
	}

	if (it == 2) {
		return "move-down";
	}

	if (it == 1) {
		return "move-left";
	}

	return "move-right";
}

void bfs(int x, int y) {
	memset(dst, -1, sizeof dst);

	dst[x][y] = 0;

	queue <pii> q;

	q.push(mp(x, y));

	int ansx = -1, ansy = -1;

	while (!q.empty()) {
		int x1 = q.front().first;
		int y1 = q.front().second;

		q.pop();

		if (ex[x1][y1]) {
			ansx = x1;
			ansy = y1;
			break;
		}

		for (int i = 0; i < 4; i++) {
			int nx = x1 + dx[i];
			int ny = y1 + dy[i];

			if (0 <= nx && nx < n && 0 <= ny && ny < m && tp[x1][y1][i] == 0 && dst[nx][ny] == -1) {
				dst[nx][ny] = dst[x1][y1] + 1;
				pr[nx][ny] = i;
				q.push(mp(nx, ny));
			}
		}
	}

	if (ansx == -1) {
		throw 1;
	}

	vector <string> ans;

	while (ansx != x || ansy != y) {
		ans.push_back(get_str(pr[ansx][ansy]));
		int it = pr[ansx][ansy];

		ansx -= dx[it];
		ansy -= dy[it];
	}

	while (!ans.empty()) {
		printf("%s\n", ans.back().c_str());
		ans.pop_back();
	}
}

int main() {
	//freopen("input-2.txt", "r", stdin);
	int x0, y0, c, d, k, e;

	cin >> n >> n >> n >> m >> x0 >> y0 >> c >> d >> k >> e;

  cout<<"move-left move-right ";

	for (int i = 0; i < c; i++) {
		int x1, y1, x2, y2;

		cin >> x1 >> y1 >> x2 >> y2;

		tp[x1][y1][getid(x2 - x1, y2 - y1)] = 1;
		tp[x2][y2][getid(x1 - x2, y1 - y2)] = 1;
	}

	for (int i = 0; i < d; i++) {
		int x1, y1, x2, y2;

		cin >> x1 >> y1 >> x2 >> y2;

		tp[x1][y1][getid(x2 - x1, y2 - y1)] = 2;
		tp[x2][y2][getid(x1 - x2, y1 - y2)] = 2;
	}

	for (int i = 0; i < k; i++) {
		int x, y;
		scanf("%d %d", &x, &y);

		key[x][y] = true;
	}

	for (int i = 0; i < e; i++) {
		int x, y;

		scanf("%d %d", &x, &y);

		ex[x][y] = true;
	}

	memset(cmp, -1, sizeof cmp);

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			if (cmp[i][j] == -1) {
				dfs(i, j, num++);
			}
		}
	}

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			for (int it = 0; it < 4; it++) {
				if (tp[i][j][it] == 2) {
					ed[cmp[i][j]].push_back(cmp[i + dx[it]][j + dy[it]]);
				}
			}
		}
	}

	//freopen("output.txt", "w", stdout);

	if (num_of_ex[cmp[x0][y0]] != 0) {
		bfs(x0, y0);
	}
	else {
		throw 1;
	}

	//system("pause");

	return 0;
}