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