#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  int x;
  cin >> x >> x;
  string s1, s2;
  cin >> s1 >> s2;
  string s3 = {s1.front(), s1.back(), s2.front(), s2.back()};
  cout << (s3 == "<>v^" || s3 == "><^v" ? "YES" : "NO");
}
