#include <bits/stdc++.h>
using namespace std;
bool way[50][50][10];
bool visit[50][50];
bool finish;
char temp[100];
queue<pair<int, int> > bfs;
int cx[10] = {0, 0, 0, -1, 1};
int cy[10] = {0, -1, 1, 0, 0};
int main() {
  int b, k;
  scanf("%d %d", &b, &k);
  scanf("%s", temp);
  memset(way, 0, sizeof(way));
  for (int y = 1; y <= b; y += 1) {
    for (int x = 1; x <= k; x += 1) {
      if (temp[y - 1] == '<') {
        way[y][x][3] = 1;
      } else if (temp[y - 1] = '>') {
        way[y][x][4] = 1;
      }
    }
  }
  scanf("%s", temp);
  for (int x = 1; x <= k; x += 1) {
    for (int y = 1; y <= b; y += 1) {
      if (temp[x - 1] == '^') {
        way[y][x][1] = 1;
      } else if (temp[x - 1] == 'v') {
        way[y][x][2] = 1;
      }
    }
  }
  finish = 1;
  for (int y = 1; y <= b; y += 1) {
    if (!finish) break;
    for (int x = 1; x <= k; x += 1) {
      while (!bfs.empty()) bfs.pop();
      memset(visit, 0, sizeof(visit));
      bfs.push(make_pair(x, y));
      pair<int, int> cur;
      int done = 0;
      while (!bfs.empty()) {
        cur = bfs.front();
        bfs.pop();
        if (cur.second <= 0 || cur.first <= 0 || cur.second > b ||
            cur.first > k)
          continue;
        if (visit[cur.second][cur.first] == 1) continue;
        visit[cur.second][cur.first] = 1;
        done++;
        if (done == b * k) break;
        for (int z = 1; z <= 4; z++) {
          if (way[cur.second][cur.first][z] == 1) {
            bfs.push(make_pair(cur.first + cx[z], cur.second + cy[z]));
          }
        }
      }
      if (done < b * k) {
        finish = 0;
        break;
      }
    }
  }
  if (finish)
    printf("YES\n");
  else
    printf("NO\n");
  return 0;
}
