#include <bits/stdc++.h>
using namespace std;
int dirx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int diry[8] = {0, 1, 0, -1, 1, 1, -1, -1};
string str1, str2;
int main() {
  int n, m;
  cin >> n >> m;
  cin >> str1 >> str2;
  if (str1[0] == '>' && str2[0] == 'v' || str1[0] == '<' && str2[0] == '^')
    cout << "NO";
  else if (str1[0] == '>' && str2[m - 1] == '^' ||
           str1[0] == '<' && str2[m - 1] == 'v')
    cout << "NO";
  else if (str1[n - 1] == '>' && str2[0] == '^' ||
           str1[n - 1] == '<' && str2[0] == 'V')
    cout << "NO";
  else if (str1[n - 1] == '>' && str2[m - 1] == 'v' ||
           str1[n - 1] == '<' && str2[m - 1] == '^')
    cout << "NO";
  else
    cout << "YES";
}
