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

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

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

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

j = A("j")
a = B("a")
e = C("e")
c = D("c")
i = A("i")
m = D("m")
h = C("h")
k = C("k")

j.z = c
a.t = j
a.x = j
a.v = k
a.p = m
e.v = i
e.r = i
e.w = m
e.y = a
c.v = a
c.s = a
c.z = m
i.z = c
m.v = a
m.s = a
m.z = c
h.v = i
h.r = i
h.w = c
h.y = a
k.v = j
k.r = j
k.w = c
k.y = a
assert k.r.z.s.t.z.z.v.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.txt = txt

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

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

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

j = A("j")
a = B("a")
e = C("e")
c = D("c")
i = A("i")
m = D("m")
h = C("h")
k = C("k")

j.z = c
a.t = j
a.x = j
a.v = k
a.p = m
e.v = i
e.r = i
e.w = m
e.y = a
c.v = a
c.s = a
c.z = m
i.z = c
m.v = a
m.s = a
m.z = c
h.v = i
h.r = i
h.w = c
h.y = a
k.v = j
k.r = j
k.w = c
k.y = a
assert k.r.z.s.t.z.z.v.txt == "a"