#include <bits/stdc++.h>
using namespace std;
bool vis[20][20];
string hs;
string vs;
int dfs(int ur, int uc) {
  int cnt;
  int n = hs.size();
  int m = vs.size();
  vis[ur][uc] = true;
  cnt = 1;
  if (vs[uc] == '^') {
    if ((ur > 0) && (!vis[ur - 1][uc])) {
      cnt += dfs(ur - 1, uc);
    }
  } else {
    if ((ur < n - 1) && (!vis[ur + 1][uc])) {
      cnt += dfs(ur + 1, uc);
    }
  }
  if (hs[ur] == '<') {
    if ((uc > 0) && (!vis[ur][uc - 1])) {
      cnt += dfs(ur, uc - 1);
    }
  } else {
    if ((uc < m - 1) && (!vis[ur][uc + 1])) {
      cnt += dfs(ur, uc + 1);
    }
  }
  return cnt;
}
int main(int argc, char **argv) {
  ios_base::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  cin >> hs;
  cin >> vs;
  int verts = m * n;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      memset(vis, 0, sizeof(vis));
      if (dfs(i, j) != verts) {
        cout << "NO" << endl;
        return 0;
      }
    }
  }
  cout << "YES" << endl;
  return 0;
}
