#include <iostream>
#include <vector>
using namespace std;
using chr_t = char;
using coord_t = size_t;
struct coord {
coord_t x, y; };
const chr_t content[] = {
"ABCDEFGHIJKLMNOPQRSTUVWXYZ" };
const chr_t delim[] = " ";
const size_t CONTENT_SIZE = sizeof(content) / sizeof(chr_t) - 1;
inline bool next_pos(const size_t M, const size_t N, const vector<vector<chr_t>>& a, coord& c) {
static unsigned direction = 0;
for (unsigned i = 0; i < 4; &