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

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

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

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

c = A("c")
n = B("n")
b = C("b")
j = D("j")
g = C("g")
k = C("k")

c.v = j
c.s = j
n.y = c
n.v = c
n.t = j
n.u = k
b.o = n
b.z = n
b.u = c
b.s = c
j.z = n
g.o = n
g.z = n
g.u = c
g.s = c
k.o = n
k.z = n
k.u = c
k.s = c
assert g.z.v.s.z.t.z.txt == "
class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.s: D = None
        self.txt = txt

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

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

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

c = A("c")
n = B("n")
b = C("b")
j = D("j")
g = C("g")
k = C("k")

c.v = j
c.s = j
n.y = c
n.v = c
n.t = j
n.u = k
b.o = n
b.z = n
b.u = c
b.s = c
j.z = n
g.o = n
g.z = n
g.u = c
g.s = c
k.o = n
k.z = n
k.u = c
k.s = c
assert g.z.v.s.z.t.z.txt == "n"