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

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

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

e = A("e")
f = B("f")
k = C("k")
l = B("l")
m = C("m")
i = A("i")

e.q = k
e.t = f
e.x = m
f.s = l
f.z = l
f.y = k
k.t = l
k.s = l
l.s = f
l.z = f
l.y = m
m.t = l
m.s = l
i.q = k
i.t = f
i.x = m
assert k.s.z.y.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.t: B = None
        self.x: C = None
        self.txt = txt

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

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

e = A("e")
f = B("f")
k = C("k")
l = B("l")
m = C("m")
i = A("i")

e.q = k
e.t = f
e.x = m
f.s = l
f.z = l
f.y = k
k.t = l
k.s = l
l.s = f
l.z = f
l.y = m
m.t = l
m.s = l
i.q = k
i.t = f
i.x = m
assert k.s.z.y.txt == "k"