#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  int visited[50][50] = {};
  cin >> n >> m;
  string str1;
  cin >> str1;
  string str2;
  cin >> str2;
  for (int sx = 1; sx <= n; sx++)
    for (int sy = 1; sy <= m; sy++) {
      memset(visited, 0, sizeof(visited));
      visited[sx][sy] = 1;
      queue<pair<int, int> > Q;
      Q.push(make_pair(sx, sy));
      while (!Q.empty()) {
        int xx = Q.front().first;
        int yy = Q.front().second;
        Q.pop();
        if (str1[xx - 1] == '<') {
          if (yy - 1 > 0 && visited[xx][yy - 1] == 0) {
            visited[xx][yy - 1] = 1;
            Q.push(make_pair(xx, yy - 1));
          }
        }
        if (str1[xx - 1] == '>') {
          if (yy + 1 <= m && visited[xx][yy + 1] == 0) {
            visited[xx][yy + 1] = 1;
            Q.push(make_pair(xx, yy + 1));
          }
        }
        if (str2[yy - 1] == '^') {
          if (xx - 1 > 0 && visited[xx - 1][yy] == 0) {
            visited[xx - 1][yy] = 1;
            Q.push(make_pair(xx - 1, yy));
          }
        }
        if (str2[yy - 1] == 'v') {
          if (xx + 1 <= n && visited[xx + 1][yy] == 0) {
            visited[xx + 1][yy] = 1;
            Q.push(make_pair(xx + 1, yy));
          }
        }
      }
      for (int i = 1; i <= n; i++)
        for (int j = 1; j <= m; j++)
          if (visited[i][j] == 0) {
            cout << "NO" << endl;
            exit(0);
          }
    }
  cout << "YES" << endl;
  return 0;
}
