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

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

class C:
    def __init__(self, txt: str):
        self.w: B = None
        self.r: B = None
        self.p: B = None
        self.txt = txt

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.w: B = None
        self.r: B = None
        self.p: B = None
        self.txt = txt

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

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

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