#include <bits/stdc++.h>
using namespace std;
const int N = 25;
char dx[N], nb[N];
int n, m;
signed main() {
  cin >> n >> m;
  cin >> dx + 1 >> nb + 1;
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) {
      vector<vector<bool> > check(n + 1, vector<bool>(m + 1));
      check[i][j] = 1;
      vector<pair<int, int> > q;
      q.push_back({i, j});
      for (int k = 0; k < q.size(); ++k) {
        int x2 = q[k].first, y2 = q[k].second;
        int x3 = x2, y3 = y2;
        if (nb[y3] == '^')
          --x3;
        else
          ++x3;
        if (x3 >= 1 && x3 <= n && !check[x3][y3]) {
          q.push_back(make_pair(x3, y3));
          check[x3][y3] = 1;
        }
        int x4 = x2, y4 = y2;
        if (dx[x4] == '<')
          --y4;
        else
          ++y4;
        if (y4 >= 1 && y4 <= m && !check[x4][y4]) {
          q.push_back(make_pair(x4, y4));
          check[x4][y4] = 1;
        }
      }
      for (int x2 = 1; x2 <= n; ++x2) {
        for (int y2 = 1; y2 <= m; ++y2) {
          if (!check[x2][y2]) {
            puts("NO");
            return 0;
          }
        }
      }
    }
  }
  puts("YES");
  return 0;
}
