#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
const double eps = 1e-11;
const int mod = 1e9 + 7;
template <class T>
inline void readInt(T &n) {
  n = 0;
  T ch = getchar();
  int sign = 1;
  while (ch < '0' || ch > '9') {
    if (ch == '-') sign = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9')
    n = (n << 3) + (n << 1) + ch - '0', ch = getchar();
  n = n * sign;
}
bool g1[100][100];
bool g2[100][100];
queue<pair<int, int> > q;
int n, m;
int arr[100][100];
bool che() {
  for (int i = ((int)(0)); i < ((int)(n)); i++) {
    for (int j = ((int)(0)); j < ((int)(m)); j++)
      if (!g2[i][j]) {
        return false;
      }
  }
  return true;
}
int main() {
  string s1, s2;
  cin >> n >> m;
  cin >> s1;
  cin >> s2;
  for (int i = ((int)(0)); i < ((int)(n)); i++) {
    for (int j = ((int)(0)); j < ((int)(m)); j++) {
      if (s1[i] == '<') {
        if (s2[j] == '^') {
          arr[i][j] = 2;
        } else {
          arr[i][j] = 1;
        }
      } else {
        if (s2[j] == '^') {
          arr[i][j] = 4;
        } else {
          arr[i][j] = 3;
        }
      }
    }
  }
  for (int i = ((int)(0)); i < ((int)(n)); i++) {
    for (int j = ((int)(0)); j < ((int)(m)); j++) {
      memset(g1, false, sizeof(g1));
      memset(g2, false, sizeof(g2));
      q.push(make_pair(i, j));
      g2[i][j] = true;
      while (!q.empty()) {
        pair<int, int> ss;
        ss = q.front();
        q.pop();
        int ind1 = ss.first;
        int ind2 = ss.second;
        if (g1[ind1][ind2] == false) {
          g1[ind1][ind2] = true;
          g2[ind1][ind2] = true;
          if (arr[ind1][ind2] == 1) {
            for (int k = ind1; k < n; k++) {
              for (int l = ind2; l >= 0; l--) {
                g2[k][l] = true;
                if (!g1[k][l]) {
                  q.push(make_pair(k, l));
                }
              }
            }
          } else if (arr[ind1][ind2] == 2) {
            for (int k = ind1; k >= 0; k--) {
              for (int l = ind2; l >= 0; l--) {
                g2[k][l] = true;
                if (!g1[k][l]) q.push(make_pair(k, l));
              }
            }
          } else if (arr[ind1][ind2] == 3) {
            for (int k = ind1; k < n; k++) {
              for (int l = ind2; l < m; l++) {
                g2[k][l] = true;
                if (!g1[k][l]) q.push(make_pair(k, l));
              }
            }
          } else if (arr[ind1][ind2] == 4) {
            for (int k = ind1; k >= 0; k--) {
              for (int l = ind2; l < m; l++) {
                g2[k][l] = true;
                if (!g1[k][l]) q.push(make_pair(k, l));
              }
            }
          }
        }
      }
      if (!che()) {
        cout << "NO" << endl;
        return 0;
      }
    }
  }
  cout << "YES" << endl;
}
