#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int a, b, c, d, e, f, g, h[50][50];
  string x, y, z;
  cin >> a >> b >> x >> y;
  if ((x[0] == '<' && y[0] == 'v' && x[a - 1] == '>' && y[b - 1] == '^') ||
      (x[a - 1] == '<' && y[b - 1] == 'v' && x[0] == '>' && y[0] == '^'))
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;
}
