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

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

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

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

h.t = i
h.x = n
h.z = k
m.y = f
m.o = k
m.x = g
f.x = b
f.s = a
i.t = h
i.x = f
i.z = k
e.t = i
e.x = f
e.z = k
g.y = f
g.o = m
g.x = m
b.y = f
b.o = g
b.x = g
k.y = a
k.o = m
k.x = m
a.x = g
a.s = n
n.x = k
n.s = f
assert n.x.x.x.y.txt == "
class A:
    def __init__(self, txt: str):
        self.t: A = None
        self.x: C = None
        self.z: B = None
        self.txt = txt

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

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

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

h.t = i
h.x = n
h.z = k
m.y = f
m.o = k
m.x = g
f.x = b
f.s = a
i.t = h
i.x = f
i.z = k
e.t = i
e.x = f
e.z = k
g.y = f
g.o = m
g.x = m
b.y = f
b.o = g
b.x = g
k.y = a
k.o = m
k.x = m
a.x = g
a.s = n
n.x = k
n.s = f
assert n.x.x.x.y.txt == "f"