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

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: A = None
        self.p: D = None
        self.r: B = None
        self.x: B = None
        self.y: D = None
        self.txt = txt

n = A("n")
b = B("b")
d = C("d")
g = D("g")
e = E("e")
i = B("i")
l = A("l")
a = A("a")

n.w = g
n.r = d
n.p = l
n.u = b
b.v = d
d.z = b
d.v = e
g.x = a
g.v = d
g.r = e
e.u = a
e.p = g
e.y = g
e.r = b
e.x = b
i.v = d
l.w = g
l.r = d
l.p = n
l.u = b
a.w = g
a.r = d
a.p = l
a.u = i
assert b.v.z.v.z.v.z.txt == "
class A:
    def __init__(self, txt: str):
        self.w: D = None
        self.r: C = None
        self.p: A = None
        self.u: B = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: A = None
        self.p: D = None
        self.r: B = None
        self.x: B = None
        self.y: D = None
        self.txt = txt

n = A("n")
b = B("b")
d = C("d")
g = D("g")
e = E("e")
i = B("i")
l = A("l")
a = A("a")

n.w = g
n.r = d
n.p = l
n.u = b
b.v = d
d.z = b
d.v = e
g.x = a
g.v = d
g.r = e
e.u = a
e.p = g
e.y = g
e.r = b
e.x = b
i.v = d
l.w = g
l.r = d
l.p = n
l.u = b
a.w = g
a.r = d
a.p = l
a.u = i
assert b.v.z.v.z.v.z.txt == "b"