#include <bits/stdc++.h>
using namespace std;
int32_t main(void) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, m;
  cin >> n >> m;
  string h, v;
  cin >> h >> v;
  if ((h[0] == '>' && v[m - 1] == 'v' && h[n - 1] == '<' && v[0] == '^') ||
      (h[0] == '<' && v[m - 1] == '^' && h[n - 1] == '>' && v[0] == 'v')) {
    cout << "YES" << endl;
  } else
    cout << "NO" << endl;
  return 0;
}
