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

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

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

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

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

n = A("n")
c = B("c")
a = C("a")
d = D("d")
f = E("f")
m = E("m")
g = B("g")
h = B("h")
b = C("b")

n.y = b
n.u = d
n.v = g
c.w = g
c.p = n
a.z = f
a.u = c
d.s = h
d.w = c
d.p = b
d.u = m
f.r = m
f.p = n
f.q = n
f.y = d
m.r = f
m.p = n
m.q = n
m.y = d
g.w = h
g.p = n
h.w = c
h.p = n
b.z = m
b.u = c
assert f.y.w.p.u.p.u.p.u.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.u: D = None
        self.v: B = None
        self.txt = txt

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

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

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

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

n = A("n")
c = B("c")
a = C("a")
d = D("d")
f = E("f")
m = E("m")
g = B("g")
h = B("h")
b = C("b")

n.y = b
n.u = d
n.v = g
c.w = g
c.p = n
a.z = f
a.u = c
d.s = h
d.w = c
d.p = b
d.u = m
f.r = m
f.p = n
f.q = n
f.y = d
m.r = f
m.p = n
m.q = n
m.y = d
g.w = h
g.p = n
h.w = c
h.p = n
b.z = m
b.u = c
assert f.y.w.p.u.p.u.p.u.txt == "d"