#include <bits/stdc++.h>
using namespace std;
long long int binexp(long long int a, long long int b) {
  long long int lvl = 1;
  while (b > 0) {
    if (b & 1) lvl = lvl * a;
    a = a * a;
  }
  return lvl;
}
long long int modexp(long long int a, long long int b, long long int m) {
  long long int lvl = 1;
  while (b > 0) {
    if (b & 1) {
      lvl = lvl * a % m;
    }
    a = a * a % m;
  }
  return lvl % m;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(nullptr);
  {
    int n, m;
    cin >> n >> m;
    string x, y;
    cin >> x >> y;
    int flag = 1;
    if (y[0] == '^' && x[0] == '<') flag = 0;
    if (y[0] == 'v' && x[n - 1] == '<') flag = 0;
    if (y[m - 1] == '^' && x[0] == '>') flag = 0;
    if (y[m - 1] == 'v' && x[n - 1] == '>') flag = 0;
    if (flag)
      cout << "YES";
    else
      cout << "NO";
  }
}
