#include <bits/stdc++.h>
using namespace std;
struct vahag {
  int hor, ver;
};
vahag a[25][25];
const int N = 100005;
int n, m, i, j, k, q, s, w, v, ans;
string t, p;
int bfs(int i, int j) {
  int qanak = 0;
  bool mark[25][25] = {0};
  queue<int> xx, yy;
  xx.push(i);
  yy.push(j);
  mark[i][j] = 1;
  while (!xx.empty()) {
    qanak++;
    int x = xx.front();
    int y = yy.front();
    if (x + a[x][y].ver >= 1 && x + a[x][y].ver <= n &&
        mark[x + a[x][y].ver][y] == 0) {
      mark[x + a[x][y].ver][y] = 1;
      xx.push(x + a[x][y].ver);
      yy.push(y);
    }
    if (y + a[x][y].hor >= 1 && y + a[x][y].hor <= m &&
        mark[x][y + a[x][y].hor] == 0) {
      mark[x][y + a[x][y].hor] = 1;
      xx.push(x);
      yy.push(y + a[x][y].hor);
    }
    xx.pop();
    yy.pop();
  }
  return qanak;
}
int main() {
  cin >> n >> m;
  cin >> t >> p;
  for (i = 0; i < t.length(); i++) {
    if (t[i] == '<')
      for (j = 0; j < p.length(); j++) a[i + 1][j + 1].hor = -1;
    else
      for (j = 0; j < p.length(); j++) a[i + 1][j + 1].hor = 1;
  }
  for (j = 0; j < p.length(); j++) {
    if (p[j] == '^')
      for (i = 0; i < t.length(); i++) a[i + 1][j + 1].ver = -1;
    else
      for (i = 0; i < t.length(); i++) a[i + 1][j + 1].ver = 1;
  }
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= m; j++) {
      int pop = bfs(i, j);
      if (pop != n * m) {
        cout << "NO" << endl;
        return 0;
      }
    }
  }
  cout << "YES" << endl;
  return 0;
}
