#include <bits/stdc++.h>
using namespace std;
string v, h;
bool used[21][21];
int cnt = 0;
int n, m;
void dfs(int x, int y) {
  if (used[x][y]) return;
  cnt++;
  used[x][y] = true;
  if (v[x] == '>') {
    if (y != m - 1) dfs(x, y + 1);
  } else {
    if (y > 0) dfs(x, y - 1);
  }
  if (h[y] == 'v') {
    if (x != n - 1) dfs(x + 1, y);
  } else {
    if (x > 0) dfs(x - 1, y);
  }
}
int main() {
  cin >> n >> m;
  cin >> v;
  cin >> h;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      memset(used, false, sizeof(used));
      cnt = 0;
      dfs(i, j);
      if (cnt != n * m) {
        cout << "NO" << endl;
        return 0;
      }
    }
  }
  cout << "YES" << endl;
  return 0;
}
