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