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

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

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

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

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

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

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

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

m.s = j
d.x = e
h.o = k
h.y = m
h.z = a
k.x = d
e.x = a
b.s = j
a.x = e
n.x = d
j.o = k
j.z = k
j.y = m
f.o = e
f.y = m
f.z = n
assert k.x.x.x.x.x.x.x.txt == "a"