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

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

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

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

c = A("c")
d = B("d")
i = C("i")
n = D("n")
j = D("j")
e = A("e")
a = D("a")

c.p = n
c.t = d
c.w = d
c.z = i
d.u = i
d.q = e
i.q = d
i.u = c
n.u = j
j.u = n
e.p = n
e.t = d
e.w = d
e.z = i
a.u = j
assert n.u.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.t: B = None
        self.z: C = None
        self.w: B = None
        self.txt = txt

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

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

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

c = A("c")
d = B("d")
i = C("i")
n = D("n")
j = D("j")
e = A("e")
a = D("a")

c.p = n
c.t = d
c.w = d
c.z = i
d.u = i
d.q = e
i.q = d
i.u = c
n.u = j
j.u = n
e.p = n
e.t = d
e.w = d
e.z = i
a.u = j
assert n.u.u.u.txt == "j"