#include <bits/stdc++.h>
using namespace std;
int main(int argc, char* argv[]) {
  int rows, cols;
  cin >> rows;
  cin >> cols;
  char c;
  vector<int>* adj_list = new vector<int>[rows * cols];
  for (int i = 0; i < rows; ++i) {
    cin >> c;
    if (c == '<') {
      for (int j = 0; j < cols - 1; ++j) {
        adj_list[i * cols + j + 1].push_back(i * cols + j);
      }
    } else {
      for (int j = 0; j < cols - 1; ++j) {
        adj_list[i * cols + j].push_back(i * cols + j + 1);
      }
    }
  }
  for (int i = 0; i < cols; ++i) {
    cin >> c;
    if (c == '^') {
      for (int j = 0; j < rows - 1; ++j) {
        adj_list[(j + 1) * cols + i].push_back(j * cols + i);
      }
    } else {
      for (int j = 0; j < rows - 1; ++j) {
        adj_list[j * cols + i].push_back((j + 1) * cols + i);
      }
    }
  }
  stack<int> dfsStack;
  dfsStack.push(0);
  int visited[rows * cols];
  for (int i = 0; i < rows * cols; ++i) {
    visited[i] = -1;
  }
  visited[0] = 1;
  int no_visited = 1;
  while (!dfsStack.empty()) {
    int current = dfsStack.top();
    dfsStack.pop();
    for (int i = 0; i < adj_list[current].size(); ++i) {
      int toVisit = adj_list[current][i];
      if (visited[toVisit] == -1) {
        dfsStack.push(toVisit);
        visited[toVisit] = 1;
        no_visited++;
      }
    }
  }
  for (int i = 0; i < rows * cols; ++i) {
    if (visited[i] == -1) {
      cout << "NO" << endl;
      return 0;
    }
  }
  vector<int>* adj_list2 = new vector<int>[rows * cols];
  for (int i = 0; i < rows * cols; ++i) {
    for (int j = 0; j < adj_list[i].size(); ++j) {
      adj_list2[adj_list[i][j]].push_back(i);
    }
  }
  dfsStack.push(0);
  for (int i = 0; i < rows * cols; ++i) {
    visited[i] = -1;
  }
  visited[0] = 1;
  no_visited = 1;
  while (!dfsStack.empty()) {
    int current = dfsStack.top();
    dfsStack.pop();
    for (int i = 0; i < adj_list2[current].size(); ++i) {
      int toVisit = adj_list2[current][i];
      if (visited[toVisit] == -1) {
        dfsStack.push(toVisit);
        visited[toVisit] = 1;
        no_visited++;
      }
    }
  }
  for (int i = 0; i < rows * cols; ++i) {
    if (visited[i] == -1) {
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
  return 0;
}
