#include <bits/stdc++.h>
using namespace std;
bool vis[22][22];
int r[4] = {1, -1, 0, 0};
int c[4] = {0, 0, 1, -1};
string rowsign, colsign;
int row, col, cnt;
map<char, int> mp;
bool isin(int x, int y) {
  if (x >= 0 && x < row && y >= 0 && y < col) return true;
  return false;
}
void bfs(int sx, int sy) {
  pair<int, int> xy;
  queue<pair<int, int> > q;
  int x, y, nx, ny, ij;
  q.push({sx, sy});
  vis[sx][sy] = true;
  while (!q.empty()) {
    xy = q.front();
    x = xy.first;
    y = xy.second;
    q.pop();
    cnt++;
    ij = mp[rowsign[x]];
    nx = r[ij] + x;
    ny = c[ij] + y;
    if (isin(nx, ny) && (!vis[nx][ny])) {
      q.push({nx, ny});
      vis[nx][ny] = true;
    }
    ij = mp[colsign[y]];
    nx = r[ij] + x;
    ny = c[ij] + y;
    if (isin(nx, ny) && (!vis[nx][ny])) {
      q.push({nx, ny});
      vis[nx][ny] = true;
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  mp.insert({'<', 3});
  mp.insert({'>', 2});
  mp.insert({'v', 0});
  mp.insert({'^', 1});
  int i, j, k, l;
  bool flag;
  while (cin >> row >> col) {
    cin >> rowsign >> colsign;
    for (i = 0; i < row; i++) {
      for (j = 0; j < col; j++) {
        memset(vis, false, sizeof(vis));
        flag = false;
        cnt = 0;
        bfs(i, j);
        if (cnt != row * col) {
          flag = true;
          break;
        }
      }
      if (flag) break;
    }
    if (flag)
      cout << "NO\n";
    else
      cout << "YES\n";
  }
  return 0;
}
