#include <bits/stdc++.h>
using namespace std;
const int MAXN = -1;
bool d[500][500];
bool g[500][500];
bool used[500];
int len;
void dfs(int v, int from) {
  used[v] = true;
  d[from][v] = true;
  for (int i = 0; i < len; i++) {
    if (g[v][i] && !used[i]) dfs(i, from);
  }
}
void solve() {
  int n, m;
  cin >> n >> m;
  vector<int> h(n);
  vector<int> w(m);
  string s;
  cin >> s;
  for (int i = 0; i < n; i++) {
    if (s[i] == '>') h[i] = 1;
  }
  cin >> s;
  for (int i = 0; i < m; i++) {
    if (s[i] == '^') w[i] = 1;
  }
  for (int i = 0; i < n * m; i++) {
    int x = i / m;
    int y = i % m;
    int k = -1;
    if (h[x] == 1) {
      k = 1;
    }
    for (int y2 = y; y2 != -1 && y2 != m; y2 += k) {
      g[i][x * m + y2] = true;
    }
    k = 1;
    if (w[y] == 1) k = -1;
    for (int x2 = x; x2 != -1 && x2 != n; x2 += k) {
      g[i][x2 * m + y] = true;
    }
  }
  len = n * m;
  for (int i = 0; i < len; i++) {
    memset(used, 0, sizeof used);
    dfs(i, i);
  }
  bool ok = true;
  for (int i = 0; i < len; i++)
    for (int j = 0; j < len; j++)
      if (!d[i][j]) ok = false;
  cout << (ok ? "YES" : "NO") << "\n";
}
struct time_stamper {
  time_stamper(string const&) {}
};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  time_stamper t("main");
  solve();
  cerr << "\n\n-----END------\n";
}
