#include <bits/stdc++.h>
using namespace std;
const int N = 1e2 + 5;
const long long int infP = 1e18;
void solve() {
  long long int n, m;
  cin >> n >> m;
  string row, col;
  cin >> row >> col;
  if (row[0] == '>' and row[n - 1] == '<' and col[0] == '^' and
      col[m - 1] == 'v')
    cout << "YES";
  else if (row[0] == '<' and row[n - 1] == '>' and col[0] == 'v' and
           col[m - 1] == '^')
    cout << "YES";
  else
    cout << "NO";
}
void debug(long long int tt) {}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--) {
    solve();
  }
}
