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

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

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

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

e = A("e")
j = B("j")
g = C("g")
i = D("i")
a = D("a")
n = C("n")
b = D("b")

e.z = g
j.s = g
j.v = a
g.z = e
g.y = n
g.o = j
g.p = i
i.u = n
a.u = n
n.z = e
n.y = g
n.o = j
n.p = i
b.u = g
assert g.y.y.p.u.o.v.u.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.txt = txt

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

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

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

e = A("e")
j = B("j")
g = C("g")
i = D("i")
a = D("a")
n = C("n")
b = D("b")

e.z = g
j.s = g
j.v = a
g.z = e
g.y = n
g.o = j
g.p = i
i.u = n
a.u = n
n.z = e
n.y = g
n.o = j
n.p = i
b.u = g
assert g.y.y.p.u.o.v.u.txt == "n"