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

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

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

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

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

k.x = e
k.s = g
e.y = n
a.v = n
a.w = n
a.t = g
a.z = g
g.r = n
g.w = n
g.z = k
n.v = a
n.w = a
n.t = g
n.z = g
j.x = e
j.s = g
assert j.x.y.w.z.r.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.s: D = None
        self.txt = txt

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

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

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

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

k.x = e
k.s = g
e.y = n
a.v = n
a.w = n
a.t = g
a.z = g
g.r = n
g.w = n
g.z = k
n.v = a
n.w = a
n.t = g
n.z = g
j.x = e
j.s = g
assert j.x.y.w.z.r.txt == "n"