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

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

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

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

m.u = e
l.p = n
l.o = e
l.z = e
d.v = n
d.w = c
c.v = l
c.w = d
e.u = m
n.p = l
n.o = e
n.z = e
k.v = n
k.w = d
assert m.u.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: A = None
        self.txt = txt

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

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

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

m.u = e
l.p = n
l.o = e
l.z = e
d.v = n
d.w = c
c.v = l
c.w = d
e.u = m
n.p = l
n.o = e
n.z = e
k.v = n
k.w = d
assert m.u.u.u.txt == "e"