class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.v: B = None
        self.y: D = None
        self.u: D = None
        self.txt = txt

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

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

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

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

e.z = n
e.v = d
e.y = m
e.u = m
n.y = e
n.o = e
k.q = m
k.y = m
k.s = d
m.t = d
m.p = d
d.y = e
d.o = e
assert m.t.o.v.y.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.v: B = None
        self.y: D = None
        self.u: D = None
        self.txt = txt

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

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

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

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

e.z = n
e.v = d
e.y = m
e.u = m
n.y = e
n.o = e
k.q = m
k.y = m
k.s = d
m.t = d
m.p = d
d.y = e
d.o = e
assert m.t.o.v.y.z.txt == "n"