#include <bits/stdc++.h>
using namespace std;
int n, m, vis[25][25];
string h, v;
bool valid(int x, int y) { return (x >= 0 && x < n && y >= 0 && y < m); }
void bfs(int x, int y) {
  queue<pair<int, int> > q;
  vis[x][y] = 1;
  q.push(make_pair(x, y));
  while (!q.empty()) {
    auto front = q.front();
    q.pop();
    int u = front.first, w = front.second;
    if (h[u] == '>') {
      if (valid(u, w + 1) && !vis[u][w + 1]) {
        vis[u][w + 1] = 1;
        q.push(make_pair(u, w + 1));
      }
    } else {
      if (valid(u, w - 1) && !vis[u][w - 1]) {
        vis[u][w - 1] = 1;
        q.push(make_pair(u, w - 1));
      }
    }
    if (v[w] == 'v') {
      if (valid(u + 1, w) && !vis[u + 1][w]) {
        vis[u + 1][w] = 1;
        q.push(make_pair(u + 1, w));
      }
    } else {
      if (valid(u - 1, w) && !vis[u - 1][w]) {
        vis[u - 1][w] = 1;
        q.push(make_pair(u - 1, w));
      }
    }
  }
}
int main() {
  cin >> n >> m;
  cin >> h >> v;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      memset(vis, 0, sizeof vis);
      bfs(i, j);
      for (int k = 0; k < n; k++) {
        for (int l = 0; l < m; l++) {
          if (!vis[k][l]) {
            cout << "NO";
            return 0;
          }
        }
      }
    }
  }
  cout << "YES";
  return 0;
}
