#include <bits/stdc++.h>
using namespace std;
int dis[401][401];
int flyd(int n) {
  for (int k = 0; k < n; k++) {
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        dis[i][j] = min(dis[i][k] + dis[k][j], dis[i][j]);
      }
    }
  }
  int ret = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      ret += dis[i][j];
    }
  }
  return ret;
}
int main() {
  int n, m;
  string a, b;
  scanf("%d%d", &n, &m);
  cin >> a;
  cin >> b;
  for (int i = 0; i < 401; i++) {
    for (int j = 0; j < 401; j++) dis[i][j] = 1;
  }
  for (int i = 0; i < n; i++) {
    if (a[i] == '>') {
      for (int j = 0; j + 1 < m; j++)
        for (int k = j; k < m; k++) dis[i * m + j][i * m + k] = 0;
    } else {
      for (int j = m - 1; j > 0; j--)
        for (int k = j; k >= 0; k--) dis[i * m + j][i * m + k] = 0;
    }
  }
  for (int i = 0; i < m; i++) {
    if (b[i] == 'v') {
      for (int j = 0; j + 1 < n; j++)
        for (int k = j; k < n; k++) dis[j * m + i][k * m + i] = 0;
    } else {
      for (int j = n - 1; j > 0; j--)
        for (int k = j; k >= 0; k--) dis[j * m + i][k * m + i] = 0;
    }
  }
  int ans = flyd(n * m);
  if (ans == 0)
    puts("YES");
  else
    puts("NO");
}
