#include <bits/stdc++.h>
using namespace std;
void func(vector<vector<int> > &A, vector<vector<int> > &B,
          vector<vector<int> > &C, int num) {
  int i, j, k;
  for (i = 0; i < num; ++i)
    for (j = 0; j < num; ++j)
      for (k = 0; k < num; ++k)
        if (A[j][i] && B[i][k]) C[j][k] = 1;
}
int main() {
  int i, j, k, n, m, num;
  string str1, str2;
  cin >> n >> m >> str1 >> str2;
  num = n * m;
  vector<vector<int> > A(num, vector<int>(num, 0));
  vector<vector<vector<int> > > vec;
  vector<int> flag;
  for (i = 0; i < str1.size(); ++i) {
    if (str1[i] == '<') {
      for (j = m - 1; j >= 0; --j)
        for (k = j; k >= 0; --k) A[m * i + j][m * i + k] = 1;
    } else {
      for (j = 0; j < m; ++j)
        for (k = j; k < m; ++k) A[m * i + j][m * i + k] = 1;
    }
  }
  for (i = 0; i < str2.size(); ++i) {
    if (str2[i] == 'v') {
      for (j = 0; j < n; ++j)
        for (k = j; k < n; ++k) A[j * m + i][k * m + i] = 1;
    } else {
      for (j = n - 1; j >= 0; --j)
        for (k = j; k >= 0; --k) A[j * m + i][k * m + i] = 1;
    }
  }
  int sum, base, p, temp;
  for (base = 1, p = 0; base <= num; base *= 2, ++p)
    ;
  flag.assign(p, 0);
  vec.assign(p, vector<vector<int> >(num, vector<int>(num, 0)));
  for (temp = num, base /= 2, --p; p >= 0; base /= 2, --p) {
    if (base <= temp) {
      temp -= base;
      flag[p] = 1;
    }
  }
  for (vec[0] = A, p = 1; p < vec.size(); ++p)
    func(vec[p - 1], vec[p - 1], vec[p], num);
  vector<vector<int> > B(num, vector<int>(num, 0)),
      output(num, vector<int>(num, 0));
  for (p = 0; p < flag.size(); ++p)
    if (flag[p]) break;
  for (B = vec[p], ++p; p < flag.size(); ++p) {
    output.assign(num, vector<int>(num, 0));
    if (flag[p]) {
      func(B, vec[p], output, num);
      B = output;
    }
  }
  for (i = 0; i < num; ++i)
    for (j = 0; j < num; ++j)
      if (i != j && !B[i][j]) {
        cout << "NO" << endl;
        return 0;
      }
  cout << "YES" << endl;
  return 0;
}
