#include <bits/stdc++.h>
using namespace std;
const int N = 1e2 + 5;
const long long int infP = 1e18;
void solve() {
  long long int n, m;
  cin >> n >> m;
  string row, col;
  cin >> row >> col;
  bool netans = true;
  for (long long int sx = 0; sx < n; sx++) {
    for (long long int sy = 0; sy < m; sy++) {
      bool ans[n][m];
      memset(ans, false, sizeof(ans));
      queue<pair<long long int, long long int> > q;
      q.push({sx, sy});
      ans[sx][sy] = true;
      while (!q.empty()) {
        pair<long long int, long long int> p = q.front();
        q.pop();
        long long int x = p.first;
        long long int y = p.second;
        if (row[x] == '>' and y + 1 < m and !ans[x][y + 1]) {
          ans[x][y + 1] = true;
          q.push({x, y + 1});
        } else if (row[x] == '<' and y - 1 >= 0 and !ans[x][y - 1]) {
          ans[x][y - 1] = true;
          q.push({x, y - 1});
        }
        if (col[y] == 'v' and x + 1 < n and !ans[x + 1][y]) {
          ans[x + 1][y] = true;
          q.push({x + 1, y});
        } else if (col[y] == '^' and x - 1 >= 0 and !ans[x - 1][y]) {
          ans[x - 1][y] = true;
          q.push({x - 1, y});
        }
      }
      bool flag = true;
      for (auto &x : ans) {
        for (auto y : x) {
          if (!y) flag = false;
        }
      }
      if (!flag) netans = false;
    }
  }
  if (netans)
    cout << "YES";
  else
    cout << "NO";
}
void debug(long long int tt) {}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--) {
    solve();
  }
}
