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