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

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

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

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

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

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

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

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

b.x = i
f.z = b
f.w = k
k.s = h
i.s = n
j.s = n
h.x = i
e.s = b
n.x = e
m.z = n
m.w = i
assert n.x.s.x.s.x.s.x.txt == "i"