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