#include <bits/stdc++.h>
using namespace std;
template <class T1>
void debug(T1 e) {
  cout << e << endl;
}
template <class T1, class T2>
void debug(T1 e1, T2 e2) {
  cout << e1 << "\t" << e2 << endl;
}
template <class T1, class T2, class T3>
void debug(T1 e1, T2 e2, T3 e3) {
  cout << e1 << "\t" << e2 << "\t" << e3 << endl;
}
template <class T1, class T2, class T3, class T4>
void debug(T1 e1, T2 e2, T3 e3, T4 e4) {
  cout << e1 << "\t" << e2 << "\t" << e3 << "\t" << e4 << endl;
}
template <class T1, class T2, class T3, class T4, class T5>
void debug(T1 e1, T2 e2, T3 e3, T4 e4, T5 e5) {
  cout << e1 << "\t" << e2 << "\t" << e3 << "\t" << e4 << "\t" << e5 << endl;
}
template <class T1, class T2, class T3, class T4, class T5, class T6>
void debug(T1 e1, T2 e2, T3 e3, T4 e4, T5 e5, T6 e6) {
  cout << e1 << "\t" << e2 << "\t" << e3 << "\t" << e4 << "\t" << e5 << "\t"
       << e6 << endl;
}
template <class T>
void debug(vector<vector<T> > e, int row, int col) {
  int i, j;
  for (i = 0; i < row; i++) {
    for (j = 0; j < col; j++) cout << e[i][j] << " ";
    cout << endl;
  }
  cout << endl;
}
template <class T>
void debug(vector<basic_string<T> > e, int row, int col) {
  int i, j;
  for (i = 0; i < row; i++) {
    for (j = 0; j < col; j++) cout << e[i][j];
    cout << endl;
  }
  cout << endl;
}
template <class T>
void debug(T e[110][110], int row, int col) {
  int i, j;
  for (i = 0; i < row; i++) {
    for (j = 0; j < col; j++) cout << e[i][j] << " ";
    cout << endl;
  }
}
template <class T>
string toString(T n) {
  ostringstream oss;
  oss << n;
  oss.flush();
  return oss.str();
}
int toInt(string s) {
  int r = 0;
  istringstream sin(s);
  sin >> r;
  return r;
}
bool isVowel(char ch) {
  ch = tolower(ch);
  if (ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u')
    return true;
  return false;
}
bool isUpper(char c) { return c >= 'A' && c <= 'Z'; }
bool isLower(char c) { return c >= 'a' && c <= 'z'; }
vector<int> adj[1005];
int col[1005], low[1005], tim[1005], timer;
int group_id[1005], components;
stack<int> S;
void scc(int u) {
  int i, v, tem;
  col[u] = 1;
  low[u] = tim[u] = timer++;
  S.push(u);
  for (i = 0; i <= ((int)adj[u].size()) - 1; i++) {
    v = adj[u][i];
    if (col[v] == 1)
      low[u] = min(low[u], tim[v]);
    else if (col[v] == 0) {
      scc(v);
      low[u] = min(low[u], low[v]);
    }
  }
  if (low[u] == tim[u]) {
    do {
      tem = S.top();
      S.pop();
      group_id[tem] = components;
      col[tem] = 2;
    } while (tem != u);
    components++;
  }
}
int TarjanSCC(int n) {
  int i;
  timer = components = 0;
  memset(col, 0, sizeof(col));
  while (!S.empty()) S.pop();
  for (i = 0; i <= n - 1; i++)
    if (col[i] == 0) scc(i);
  return components;
}
int n, m;
int getnode(int r, int c) { return r * m + c; }
void makeEdge(int a, int b, int c, int d) {
  if (c < 0 || c >= n) return;
  if (d < 0 || d >= m) return;
  adj[getnode(a, b)].push_back(getnode(c, d));
}
int main() {
  while (cin >> n >> m) {
    string str1, str2;
    cin >> str1 >> str2;
    int i, j;
    for (i = 0; i <= n - 1; i++)
      for (j = 0; j <= m - 1; j++) {
        if (str1[i] == '>')
          makeEdge(i, j, i, j + 1);
        else
          makeEdge(i, j, i, j - 1);
        if (str2[j] == 'v')
          makeEdge(i, j, i + 1, j);
        else
          makeEdge(i, j, i - 1, j);
      }
    if (TarjanSCC(n * m) == 1)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
  return 0;
}
