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

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

class C:
    def __init__(self, txt: str):
        self.t: A = None
        self.y: D = None
        self.txt = txt

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

i = A("i")
h = B("h")
e = C("e")
m = D("m")
d = B("d")
a = B("a")

i.z = e
h.o = m
h.z = m
h.y = i
h.x = e
e.t = i
e.y = m
m.u = e
m.s = d
m.r = i
d.o = m
d.z = m
d.y = i
d.x = e
a.o = m
a.z = m
a.y = i
a.x = e
assert i.z.y.r.z.t.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.t: A = None
        self.y: D = None
        self.txt = txt

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

i = A("i")
h = B("h")
e = C("e")
m = D("m")
d = B("d")
a = B("a")

i.z = e
h.o = m
h.z = m
h.y = i
h.x = e
e.t = i
e.y = m
m.u = e
m.s = d
m.r = i
d.o = m
d.z = m
d.y = i
d.x = e
a.o = m
a.z = m
a.y = i
a.x = e
assert i.z.y.r.z.t.txt == "i"