#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b;
  cin >> a >> b;
  string s, s2;
  cin >> s >> s2;
  if (s[0] == '>' && s[a - 1] == '<' && s2[0] == '^' && s2[b - 1] == 'v') {
    cout << "YES\n";
  } else if (s[0] == '<' && s[a - 1] == '>' && s2[0] == 'v' &&
             s2[b - 1] == '^') {
    cout << "YES\n";
  } else
    cout << "NO\n";
  return 0;
}
