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

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

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

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

l = A("l")
d = B("d")
e = C("e")
j = D("j")
i = C("i")
k = D("k")
b = B("b")

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

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

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

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

l = A("l")
d = B("d")
e = C("e")
j = D("j")
i = C("i")
k = D("k")
b = B("b")

l.o = j
l.p = j
l.q = d
l.y = k
d.y = e
d.q = b
d.s = j
e.u = j
e.q = j
j.p = k
j.z = l
i.u = k
i.q = k
k.p = j
k.z = l
b.y = e
b.q = d
b.s = j
assert i.u.z.p.txt == "j"