#include <bits/stdc++.h>
using namespace std;
string a = "<>^v";
int main() {
  int n, m;
  cin >> n >> m;
  string s, t;
  cin >> s >> t;
  if ((s[0] == a[0] && s[s.size() - 1] == a[1] && t[0] == a[3] &&
       t[t.size() - 1] == a[2]))
    cout << "YES" << endl;
  else if ((s[0] == a[1] && s[s.size() - 1] == a[0] and t[0] == a[2] and
            t[t.size() - 1] == a[3]))
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;
}
