#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m;
  while (cin >> n >> m) {
    string s1;
    cin >> s1;
    string s2;
    cin >> s2;
    int flag = 1;
    if (s1[0] == '>' && s2[m - 1] == '^') flag = 0;
    if (s1[n - 1] == '>' && s2[m - 1] == 'v') flag = 0;
    if (s1[0] == '<' && s2[0] == '^') flag = 0;
    if (s1[n - 1] == '<' && s2[0] == 'v') flag = 0;
    cout << (flag ? "YES" : "NO") << endl;
  }
  return 0;
}
