#include <bits/stdc++.h>
using namespace std;
long long i, j, k, n;
signed main() {
  int n, m;
  cin >> n >> m;
  string s, t;
  cin >> s >> t;
  if ((s[0] == '>' && s[n - 1] == '<' && t[0] == '^' && t[m - 1] == 'v') ||
      (s[0] == '<' && s[n - 1] == '>' && t[0] == 'v' && t[m - 1] == '^')) {
    cout << "YES";
  } else
    cout << "NO";
}
