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

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

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

l = A("l")
e = B("e")
k = C("k")
m = C("m")
c = A("c")
g = C("g")
n = B("n")
i = B("i")

l.z = n
l.x = n
l.w = g
e.t = c
k.s = l
m.s = l
c.z = e
c.x = e
c.w = k
g.s = l
n.t = l
i.t = l
assert n.t.x.t.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.w: C = None
        self.x: B = None
        self.txt = txt

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

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

l = A("l")
e = B("e")
k = C("k")
m = C("m")
c = A("c")
g = C("g")
n = B("n")
i = B("i")

l.z = n
l.x = n
l.w = g
e.t = c
k.s = l
m.s = l
c.z = e
c.x = e
c.w = k
g.s = l
n.t = l
i.t = l
assert n.t.x.t.txt == "l"