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