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

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

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

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

n = A("n")
d = B("d")
l = C("l")
c = D("c")
e = D("e")
g = B("g")
b = A("b")
f = D("f")
j = D("j")
a = D("a")

n.u = a
d.s = g
d.y = g
d.p = c
d.z = l
l.p = a
l.s = a
l.v = n
l.u = n
c.x = d
c.r = e
c.u = l
e.x = g
e.r = j
e.u = l
g.s = d
g.y = d
g.p = e
g.z = l
b.u = j
f.x = d
f.r = j
f.u = l
j.x = g
j.r = a
j.u = l
a.x = d
a.r = c
a.u = l
assert g.y.z.p.r.x.s.z.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.txt = txt

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

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

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

n = A("n")
d = B("d")
l = C("l")
c = D("c")
e = D("e")
g = B("g")
b = A("b")
f = D("f")
j = D("j")
a = D("a")

n.u = a
d.s = g
d.y = g
d.p = c
d.z = l
l.p = a
l.s = a
l.v = n
l.u = n
c.x = d
c.r = e
c.u = l
e.x = g
e.r = j
e.u = l
g.s = d
g.y = d
g.p = e
g.z = l
b.u = j
f.x = d
f.r = j
f.u = l
j.x = g
j.r = a
j.u = l
a.x = d
a.r = c
a.u = l
assert g.y.z.p.r.x.s.z.u.u.txt == "a"