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

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

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

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

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

j.x = h
j.q = h
j.z = i
i.o = l
i.x = l
i.p = l
i.u = d
d.s = e
l.z = d
a.o = l
a.x = l
a.p = l
a.u = d
e.o = l
e.x = l
e.p = l
e.u = d
h.x = j
h.q = j
h.z = e
assert l.z.s.u.s.o.z.txt == "
class A:
    def __init__(self, txt: str):
        self.x: A = None
        self.q: A = None
        self.z: B = None
        self.txt = txt

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

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

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

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

j.x = h
j.q = h
j.z = i
i.o = l
i.x = l
i.p = l
i.u = d
d.s = e
l.z = d
a.o = l
a.x = l
a.p = l
a.u = d
e.o = l
e.x = l
e.p = l
e.u = d
h.x = j
h.q = j
h.z = e
assert l.z.s.u.s.o.z.txt == "d"