#include <bits/stdc++.h>
using namespace std;
int n, m;
string a, b;
bool used[22][22];
bool ok(int x, int y) { return (x >= 1 && x <= n && y >= 1 && y <= m); }
void dfs(int x, int y) {
  if (!ok(x, y)) return;
  if (used[x][y]) return;
  used[x][y] = 1;
  if (a[x] == '>')
    dfs(x, y + 1);
  else if (a[x] == '<')
    dfs(x, y - 1);
  if (b[y] == '^')
    dfs(x - 1, y);
  else
    dfs(x + 1, y);
}
void answer(string s) {
  cout << s << "\n";
  exit(0);
}
int main() {
  cin >> n >> m >> a >> b;
  a = "#" + a;
  b = "#" + b;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      memset(used, 0, sizeof(used));
      dfs(i, j);
      for (int x = 1; x <= n; x++)
        for (int y = 1; y <= m; y++)
          if (!used[x][y]) answer("NO");
    }
  answer("YES");
}
