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

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

class C:
    def __init__(self, txt: str):
        self.x: A = None
        self.txt = txt

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

n = A("n")
l = B("l")
b = C("b")
k = D("k")
j = C("j")
g = A("g")
a = D("a")
i = D("i")

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

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

class C:
    def __init__(self, txt: str):
        self.x: A = None
        self.txt = txt

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

n = A("n")
l = B("l")
b = C("b")
k = D("k")
j = C("j")
g = A("g")
a = D("a")
i = D("i")

n.p = i
n.s = k
n.t = k
l.z = i
l.s = a
l.t = n
b.x = n
k.w = n
k.x = j
k.p = l
k.u = i
j.x = n
g.p = k
g.t = k
g.s = a
a.w = g
a.x = j
a.p = l
a.u = i
i.w = n
i.x = b
i.p = l
i.u = k
assert l.s.u.p.txt == "l"