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

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

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

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

i = A("i")
m = B("m")
c = C("c")
f = D("f")
d = C("d")
h = D("h")

i.z = m
i.u = m
i.s = c
i.p = d
m.z = h
c.t = i
c.p = i
c.z = i
c.v = i
f.y = h
f.z = i
f.v = m
d.t = i
d.p = i
d.z = i
d.v = i
h.y = f
h.z = i
h.v = m
assert i.s.p.z.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.u: B = None
        self.s: C = None
        self.p: C = None
        self.txt = txt

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

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

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

i = A("i")
m = B("m")
c = C("c")
f = D("f")
d = C("d")
h = D("h")

i.z = m
i.u = m
i.s = c
i.p = d
m.z = h
c.t = i
c.p = i
c.z = i
c.v = i
f.y = h
f.z = i
f.v = m
d.t = i
d.p = i
d.z = i
d.v = i
h.y = f
h.z = i
h.v = m
assert i.s.p.z.z.z.txt == "i"