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

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

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

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

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

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

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

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

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

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

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