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

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

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

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

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

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

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

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

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

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

d.z = i
d.x = e
d.q = h
i.z = e
e.v = m
e.u = b
e.o = j
m.x = i
m.s = h
m.y = e
b.z = e
h.x = i
h.s = m
h.y = e
c.z = b
c.x = e
c.q = h
j.z = b
j.x = e
j.q = m
assert h.s.y.v.s.txt == "h"