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

class B:
    def __init__(self, txt: str):
        self.v: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.s: E = None
        self.w: D = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.r: A = None
        self.v: B = None
        self.z: B = None
        self.t: C = None
        self.txt = txt

g = A("g")
d = B("d")
i = C("i")
n = D("n")
c = E("c")
a = C("a")

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

class B:
    def __init__(self, txt: str):
        self.v: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.s: E = None
        self.w: D = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.r: A = None
        self.v: B = None
        self.z: B = None
        self.t: C = None
        self.txt = txt

g = A("g")
d = B("d")
i = C("i")
n = D("n")
c = E("c")
a = C("a")

g.v = d
g.p = d
g.u = d
g.s = n
d.v = c
i.s = c
i.w = n
n.x = c
n.t = c
n.r = c
n.w = d
n.p = d
c.r = g
c.v = d
c.z = d
c.t = a
a.s = c
a.w = n
assert a.w.p.v.r.v.txt == "d"