import std.stdio;
import std.array;
import std.string;
import std.algorithm;

string[char] next;

static this() {
    next = [
       'A': "BD",
       'B': "ACE",
       'C': "BF",
       'D': "AEG",
       'E': "BDFH",
       'F': "CEI",
       'G': "DH",
       'H': "EGI",
       'I': "FH"
    ];
}

bool movable(char c, char t) {
    return !next[c].find(t).empty;
}

void main() {
loop: foreach (_; 0 .. 1000) {
        string s = readln.chomp;
        foreach (i; 1 .. s.length) {
            if (!s[i - 1].movable(s[i])) {
                continue loop;
            }
        }
        s.writeln;
    }
}