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

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

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

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

b = A("b")
n = B("n")
i = C("i")
d = D("d")
k = D("k")
e = C("e")
j = D("j")
h = B("h")
c = C("c")

b.z = h
b.y = i
b.v = k
b.o = c
n.r = b
n.w = b
i.v = b
d.x = h
d.s = k
d.z = b
d.w = j
k.x = n
k.s = d
k.w = d
k.z = b
e.v = b
j.x = n
j.s = k
j.z = b
j.w = d
h.r = b
h.w = b
c.v = b
assert h.r.v.z.v.x.w.o.v.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.y: C = None
        self.v: D = None
        self.o: C = None
        self.txt = txt

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

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

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

b = A("b")
n = B("n")
i = C("i")
d = D("d")
k = D("k")
e = C("e")
j = D("j")
h = B("h")
c = C("c")

b.z = h
b.y = i
b.v = k
b.o = c
n.r = b
n.w = b
i.v = b
d.x = h
d.s = k
d.z = b
d.w = j
k.x = n
k.s = d
k.w = d
k.z = b
e.v = b
j.x = n
j.s = k
j.z = b
j.w = d
h.r = b
h.w = b
c.v = b
assert h.r.v.z.v.x.w.o.v.txt == "b"