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

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

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

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

j = A("j")
l = B("l")
a = C("a")
m = D("m")
i = D("i")
b = B("b")
n = A("n")
h = C("h")

j.z = l
j.y = n
l.t = b
l.o = a
a.q = n
a.y = j
m.r = i
m.p = h
m.u = b
m.s = n
i.r = m
i.p = a
i.u = b
i.s = n
b.t = l
b.o = h
n.z = l
n.y = j
h.q = j
h.y = j
assert n.z.o.q.z.o.y.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.y: A = None
        self.txt = txt

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

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

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

j = A("j")
l = B("l")
a = C("a")
m = D("m")
i = D("i")
b = B("b")
n = A("n")
h = C("h")

j.z = l
j.y = n
l.t = b
l.o = a
a.q = n
a.y = j
m.r = i
m.p = h
m.u = b
m.s = n
i.r = m
i.p = a
i.u = b
i.s = n
b.t = l
b.o = h
n.z = l
n.y = j
h.q = j
h.y = j
assert n.z.o.q.z.o.y.txt == "j"