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