#include <bits/stdc++.h>
using namespace std;
static const double EPS = 1e-9;
template <class T>
bool INRANGE(T x, T a, T b) {
  return a <= x && x <= b;
}
template <class T>
void amin(T &a, T v) {
  if (a > v) a = v;
}
template <class T>
void amax(T &a, T v) {
  if (a < v) a = v;
}
int ROUND(double x) { return (int)(x + 0.5); }
bool ISINT(double x) { return fabs(ROUND(x) - x) <= EPS; }
bool ISEQUAL(double x, double y) {
  return fabs(x - y) <= EPS * max(1.0, max(fabs(x), fabs(y)));
}
double SQSUM(double x, double y) { return x * x + y * y; }
int mtx[500][500];
int main() {
  int n, m;
  cin >> n >> m;
  string a;
  string b;
  cin >> a >> b;
  for (int c = 0; c < n * m; ++c) {
    for (int e = 0; e < n * m; ++e) {
      mtx[c][e] = ((int)1e9);
    }
  }
  for (int c = 0; c < n * m; ++c) {
    mtx[c][c] = 0;
  }
  for (int y = 0; y < n; ++y) {
    for (int x = 0; x < m - 1; ++x) {
      if (a[y] == '>') {
        mtx[((y)*m + (x))][((y)*m + (x + 1))] = 0;
      } else {
        mtx[((y)*m + (x + 1))][((y)*m + (x))] = 0;
      }
    }
  }
  for (int x = 0; x < m; ++x) {
    for (int y = 0; y < n - 1; ++y) {
      if (b[x] == 'v') {
        mtx[((y)*m + (x))][((y + 1) * m + (x))] = 0;
      } else {
        mtx[((y + 1) * m + (x))][((y)*m + (x))] = 0;
      }
    }
  }
  for (int k = 0; k < n * m; ++k) {
    for (int i = 0; i < n * m; ++i) {
      for (int j = 0; j < n * m; ++j) {
        amin(mtx[i][j], mtx[i][k] + mtx[k][j]);
      }
    }
  }
  bool ok = true;
  for (int c = 0; c < n * m; ++c) {
    for (int e = 0; e < n * m; ++e) {
      if (mtx[c][e] > 0) {
        ok = false;
        break;
      }
    }
  }
  if (ok) {
    printf("YES\n");
  } else {
    printf("NO\n");
  }
  return 0;
}
