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

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

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

i = A("i")
e = B("e")
a = C("a")
l = C("l")
n = A("n")
m = A("m")
d = C("d")

i.u = m
i.w = l
e.y = a
e.w = a
e.t = d
a.v = i
a.w = e
l.v = m
l.w = e
n.u = m
n.w = d
m.u = n
m.w = l
d.v = i
d.w = e
assert m.u.u.w.txt == "
class A:
    def __init__(self, txt: str):
        self.u: A = None
        self.w: C = None
        self.txt = txt

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

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

i = A("i")
e = B("e")
a = C("a")
l = C("l")
n = A("n")
m = A("m")
d = C("d")

i.u = m
i.w = l
e.y = a
e.w = a
e.t = d
a.v = i
a.w = e
l.v = m
l.w = e
n.u = m
n.w = d
m.u = n
m.w = l
d.v = i
d.w = e
assert m.u.u.w.txt == "l"