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

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

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

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

l.w = d
a.u = e
a.w = m
a.v = l
e.o = i
k.u = d
k.w = m
k.v = g
d.o = i
g.w = d
i.o = e
f.w = i
m.u = i
m.w = a
m.v = g
assert m.w.w.u.o.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.txt = txt

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

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

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

l.w = d
a.u = e
a.w = m
a.v = l
e.o = i
k.u = d
k.w = m
k.v = g
d.o = i
g.w = d
i.o = e
f.w = i
m.u = i
m.w = a
m.v = g
assert m.w.w.u.o.txt == "e"