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

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

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

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

d = A("d")
n = B("n")
i = C("i")
g = D("g")
c = B("c")
a = A("a")
h = D("h")

d.o = i
d.s = i
d.z = n
n.y = h
n.v = g
n.z = i
i.q = g
i.w = g
i.x = c
i.t = a
g.z = h
g.o = i
c.y = g
c.v = g
c.z = i
a.o = i
a.s = i
a.z = n
h.z = g
h.o = i
assert c.v.z.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.z: B = None
        self.s: C = None
        self.txt = txt

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

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

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

d = A("d")
n = B("n")
i = C("i")
g = D("g")
c = B("c")
a = A("a")
h = D("h")

d.o = i
d.s = i
d.z = n
n.y = h
n.v = g
n.z = i
i.q = g
i.w = g
i.x = c
i.t = a
g.z = h
g.o = i
c.y = g
c.v = g
c.z = i
a.o = i
a.s = i
a.z = n
h.z = g
h.o = i
assert c.v.z.z.z.txt == "h"