#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<string> g(n, "0");
  for (int i = 0; i < 2; i++) cin >> g[i];
  if (g[0][0] == '>' && g[0][n - 1] == '<' && g[1][0] == '^' &&
      g[1][m - 1] == 'v') {
    cout << "YES"
         << "\n";
    return 0;
  }
  if (g[0][0] == '<' && g[0][n - 1] == '>' && g[1][0] == 'v' &&
      g[1][m - 1] == '^') {
    cout << "YES"
         << "\n";
    return 0;
  }
  cout << "NO"
       << "\n";
  return 0;
}
