class A:
    def __init__(self, txt: str):
        self.s: E = 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: C = None
        self.y: D = None
        self.v: D = None
        self.q: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.z: A = None
        self.q: C = None
        self.x: D = None
        self.o: C = None
        self.txt = txt

m = A("m")
j = B("j")
c = C("c")
b = D("b")
d = E("d")
h = C("h")
i = A("i")

m.s = d
j.v = h
c.z = h
c.y = b
c.v = b
c.q = d
b.u = j
d.z = i
d.q = c
d.x = b
d.o = h
h.z = c
h.y = b
h.v = b
h.q = d
i.s = d
assert b.u.v.z.y.u.v.q.txt == "
class A:
    def __init__(self, txt: str):
        self.s: E = 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: C = None
        self.y: D = None
        self.v: D = None
        self.q: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.z: A = None
        self.q: C = None
        self.x: D = None
        self.o: C = None
        self.txt = txt

m = A("m")
j = B("j")
c = C("c")
b = D("b")
d = E("d")
h = C("h")
i = A("i")

m.s = d
j.v = h
c.z = h
c.y = b
c.v = b
c.q = d
b.u = j
d.z = i
d.q = c
d.x = b
d.o = h
h.z = c
h.y = b
h.v = b
h.q = d
i.s = d
assert b.u.v.z.y.u.v.q.txt == "d"