Problem:
Score : 900 points

Problem Statement

Takahashi has an N \times M grid, with N horizontal rows and M vertical columns.
Determine if we can place A 1 \times 2 tiles (1 vertical, 2 horizontal) and B 2 \times 1 tiles (2 vertical, 1 horizontal) satisfying the following conditions, and construct one arrangement of the tiles if it is possible:

All the tiles must be placed on the grid.

Tiles must not stick out of the grid, and no two different tiles may intersect.

Neither the grid nor the tiles may be rotated.

Every tile completely covers exactly two squares.

Constraints

1 \leq N,M \leq 1000

0 \leq A,B \leq 500000

N, M, A and B are integers.

Input

Input is given from Standard Input in the following format:

N M A B

Output

If it is impossible to place all the tiles, print NO.
Otherwise, print the following:

YES
c_{11}...c_{1M}
:
c_{N1}...c_{NM}

Here, c_{ij} must be one of the following characters: ., <, >, ^ and v. Represent an arrangement by using each of these characters as follows:

When c_{ij} is ., it indicates that the square at the i-th row and j-th column is empty;

When c_{ij} is <, it indicates that the square at the i-th row and j-th column is covered by the left half of a 1 \times 2 tile;

When c_{ij} is >, it indicates that the square at the i-th row and j-th column is covered by the right half of a 1 \times 2 tile;

When c_{ij} is ^, it indicates that the square at the i-th row and j-th column is covered by the top half of a 2 \times 1 tile;

When c_{ij} is v, it indicates that the square at the i-th row and j-th column is covered by the bottom half of a 2 \times 1 tile.

Sample Input 1

3 4 4 2

Sample Output 1

YES
<><>
^<>^
v<>v

This is one example of a way to place four 1 \times 2 tiles and three 2 \times 1 tiles on a 3 \times 4 grid.

Sample Input 2

4 5 5 3

Sample Output 2

YES
<>..^
^.<>v
v<>.^
<><>v

Sample Input 3

7 9 20 20

Sample Output 3

NO

Solution in C++14 (GCC 5.4.1) (judge verdict: Wrong Answer)

#include <bits/stdc++.h>

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

template<class T>bool chmax(T &a, const T &b) { return (a < b) ? (a = b, 1) : 0;}
template<class T>bool chmin(T &a, const T &b) { return (b < a) ? (a = b, 1) : 0;}

using ll = long long;
using R = long double;
const R EPS = 1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r) {return (r > EPS) - (r < -EPS);}
inline R sq(R x) {return sqrt(max(x, 0.0L));}

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

// Problem Specific Parameter:
char ans[1010][1010];

int main(void) {
	int n, m, a, b;
	cin >> n >> m >> a >> b;
	rep(i, n)rep(j, m) ans[i][j] = '.';

	if (n % 2 == 1) {
		int j = 0;
		while (a > 0 and j + 1 < m) {
			ans[n - 1][j] = '<';
			ans[n - 1][j + 1] = '>';
			a--, j += 2;
		}
	}

	if (m % 2 == 1) {
		int i = 0;
		while (b > 0 and i + 1 < n) {
			ans[i][m - 1] = '^';
			ans[i + 1][m - 1] = 'v';
			b--, i += 2;
		}
	}


	rep(i, n / 2)rep(j, m / 2) {
		if (a > 0) {
			rep(d, 2) {
				if (a > 0) {
					ans[2 * i + d][2 * j + 0] = '<';
					ans[2 * i + d][2 * j + 1] = '>';
					a--;
				}
			}
		} else if (b > 0) {
			rep(d, 2) {
				if (b > 0) {
					ans[2 * i + 0][2 * j + d] = '^';
					ans[2 * i + 1][2 * j + d] = 'v';
					b--;
				}
			}
		}
	}

	if (n >= 3 and m >= 3 and a > 0) {
		string pattern[3] = {"^.^", "v.v", "<>."};

		bool flag = true;
		rep(i, 3)rep(j, 3) if (pattern[i][j] != ans[n - 2 + i][m - 2 + j]) flag = false;

		if (flag) {
			a--;
			string rewrite[3] = {"^<>", "v.^", "<>v"};
			rep(i, 3)rep(j, 3) ans[n - 2 + i][m - 2 + j] = rewrite[i][j];
		}
	}

	if (n >= 3 and m >= 3 and b > 0) {
		string pattern[3] = {"<>^", "..v", "<>."};

		bool flag = true;
		rep(i, 3)rep(j, 3) if (pattern[i][j] != ans[n - 2 + i][m - 2 + j]) flag = false;

		if (flag) {
			b--;
			string rewrite[3] = {"<>^", "^.v", "v<>"};
			rep(i, 3)rep(j, 3) ans[n - 2 + i][m - 2 + j] = rewrite[i][j];
		}
	}

	//cerr << a << " " << b << endl;
	if (a == 0 and b == 0) {
		puts("YES");
		rep(i, n) {
			rep(j, m) cout << ans[i][j];
			cout << endl;
		}
	} else {
		puts("NO");
	}

	return 0;
}