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

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

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

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

j = A("j")
l = B("l")
d = C("d")
n = D("n")
g = B("g")

j.z = n
j.s = l
j.u = g
l.t = g
l.s = n
l.x = n
l.p = n
d.t = j
d.q = j
d.w = n
d.u = n
n.q = l
n.x = j
n.w = g
n.p = d
g.t = l
g.s = n
g.x = n
g.p = n
assert g.t.t.t.s.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.s: B = None
        self.u: B = None
        self.txt = txt

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

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

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

j = A("j")
l = B("l")
d = C("d")
n = D("n")
g = B("g")

j.z = n
j.s = l
j.u = g
l.t = g
l.s = n
l.x = n
l.p = n
d.t = j
d.q = j
d.w = n
d.u = n
n.q = l
n.x = j
n.w = g
n.p = d
g.t = l
g.s = n
g.x = n
g.p = n
assert g.t.t.t.s.txt == "n"