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

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

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

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

j = A("j")
n = B("n")
k = C("k")
i = D("i")
e = A("e")

j.q = i
j.o = k
j.u = e
j.p = e
n.x = i
k.y = i
i.y = j
i.s = j
e.q = i
e.o = k
e.u = j
e.p = j
assert n.x.s.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.o: C = None
        self.u: A = None
        self.p: A = None
        self.txt = txt

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

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

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

j = A("j")
n = B("n")
k = C("k")
i = D("i")
e = A("e")

j.q = i
j.o = k
j.u = e
j.p = e
n.x = i
k.y = i
i.y = j
i.s = j
e.q = i
e.o = k
e.u = j
e.p = j
assert n.x.s.q.txt == "i"