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

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

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

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

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

b = A("b")
m = B("m")
l = C("l")
d = D("d")
g = E("g")
i = A("i")

b.s = m
b.q = m
b.v = m
b.o = m
b.z = d
m.y = g
l.s = i
l.z = i
d.z = m
d.s = i
g.r = m
i.s = m
i.q = m
i.v = m
i.o = m
i.z = d
assert l.z.z.z.y.r.y.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.q: B = None
        self.v: B = None
        self.o: B = None
        self.z: D = None
        self.txt = txt

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

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

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

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

b = A("b")
m = B("m")
l = C("l")
d = D("d")
g = E("g")
i = A("i")

b.s = m
b.q = m
b.v = m
b.o = m
b.z = d
m.y = g
l.s = i
l.z = i
d.z = m
d.s = i
g.r = m
i.s = m
i.q = m
i.v = m
i.o = m
i.z = d
assert l.z.z.z.y.r.y.txt == "g"