class A:
    def __init__(self, txt: str):
        self.o: A = None
        self.x: A = None
        self.p: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: B = None
        self.s: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.s: C = None
        self.p: B = None
        self.r: A = None
        self.txt = txt

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

e.o = n
e.x = n
e.p = g
j.t = m
j.s = d
d.s = h
d.p = g
d.r = b
h.s = k
h.p = j
h.r = e
g.t = m
g.s = d
m.t = j
m.s = h
k.s = h
k.p = j
k.r = a
b.o = n
b.x = n
b.p = j
a.o = b
a.x = b
a.p = g
n.o = a
n.x = a
n.p = g
assert e.x.p.t.t.t.s.txt == "
class A:
    def __init__(self, txt: str):
        self.o: A = None
        self.x: A = None
        self.p: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: B = None
        self.s: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.s: C = None
        self.p: B = None
        self.r: A = None
        self.txt = txt

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

e.o = n
e.x = n
e.p = g
j.t = m
j.s = d
d.s = h
d.p = g
d.r = b
h.s = k
h.p = j
h.r = e
g.t = m
g.s = d
m.t = j
m.s = h
k.s = h
k.p = j
k.r = a
b.o = n
b.x = n
b.p = j
a.o = b
a.x = b
a.p = g
n.o = a
n.x = a
n.p = g
assert e.x.p.t.t.t.s.txt == "h"