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

class B:
    def __init__(self, txt: str):
        self.w: A = None
        self.v: A = None
        self.r: A = None
        self.u: B = None
        self.txt = txt

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

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

n = A("n")
b = B("b")
g = C("g")
d = D("d")
j = A("j")
h = C("h")
a = A("a")
m = C("m")
k = B("k")
l = B("l")

n.z = k
n.y = l
n.p = b
b.w = n
b.v = n
b.r = a
b.u = k
g.u = k
d.z = b
d.v = k
d.u = n
j.z = k
j.y = b
j.p = b
h.u = l
a.z = b
a.y = l
a.p = l
m.u = k
k.w = n
k.r = n
k.v = a
k.u = b
l.w = a
l.v = j
l.r = j
l.u = b
assert d.u.z.w.y.u.v.p.v.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.y: B = None
        self.p: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.w: A = None
        self.v: A = None
        self.r: A = None
        self.u: B = None
        self.txt = txt

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

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

n = A("n")
b = B("b")
g = C("g")
d = D("d")
j = A("j")
h = C("h")
a = A("a")
m = C("m")
k = B("k")
l = B("l")

n.z = k
n.y = l
n.p = b
b.w = n
b.v = n
b.r = a
b.u = k
g.u = k
d.z = b
d.v = k
d.u = n
j.z = k
j.y = b
j.p = b
h.u = l
a.z = b
a.y = l
a.p = l
m.u = k
k.w = n
k.r = n
k.v = a
k.u = b
l.w = a
l.v = j
l.r = j
l.u = b
assert d.u.z.w.y.u.v.p.v.txt == "n"