class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.q: A = None
        self.o: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: B = None
        self.w: C = None
        self.x: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.q: A = None
        self.txt = txt

e = A("e")
k = B("k")
g = C("g")
n = C("n")
a = B("a")
b = A("b")
h = B("h")
m = A("m")
j = B("j")

e.r = n
e.q = m
e.o = b
k.q = j
k.w = n
k.x = e
g.q = b
n.q = e
a.q = h
a.w = n
a.x = b
b.r = g
b.q = e
b.o = m
h.q = j
h.w = n
h.x = b
m.r = g
m.q = e
m.o = b
j.q = k
j.w = g
j.x = e
assert g.q.r.q.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.q: A = None
        self.o: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: B = None
        self.w: C = None
        self.x: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.q: A = None
        self.txt = txt

e = A("e")
k = B("k")
g = C("g")
n = C("n")
a = B("a")
b = A("b")
h = B("h")
m = A("m")
j = B("j")

e.r = n
e.q = m
e.o = b
k.q = j
k.w = n
k.x = e
g.q = b
n.q = e
a.q = h
a.w = n
a.x = b
b.r = g
b.q = e
b.o = m
h.q = j
h.w = n
h.x = b
m.r = g
m.q = e
m.o = b
j.q = k
j.w = g
j.x = e
assert g.q.r.q.txt == "b"