#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > g;
bool used[400];
void dfs(int v) {
  used[v] = true;
  for (int i = 0; i < g[v].size(); i++)
    if (!used[g[v][i]]) dfs(g[v][i]);
}
int main() {
  int n;
  int m;
  scanf("%d%d", &n, &m);
  int c = n * m;
  g.resize(c);
  string s1, s2;
  cin >> s1;
  cin >> s2;
  for (int i = 0; i < n; i++) {
    int nn = i * m;
    if (s1[i] == '<')
      for (int j = 1; j < m; j++) {
        g[nn + j].push_back(nn + j - 1);
      }
    else
      for (int j = 0; j < m - 1; j++) {
        g[nn + j].push_back(nn + j + 1);
      }
  }
  for (int i = 0; i < m; i++) {
    if (s2[i] == '^')
      for (int j = m + i; j < c; j += m) {
        g[j].push_back(j - m);
      }
    else
      for (int j = i; j < c - m; j += m) {
        g[j].push_back(j + m);
      }
  }
  bool f = true;
  for (int i = 0; i < c; i++) {
    for (int j = 0; j < c; j++) used[j] = false;
    dfs(i);
    for (int j = 0; j < c; j++)
      if (!used[j]) f = false;
    if (!f) {
      printf("NO");
      return 0;
    }
  }
  printf("YES");
}
