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