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

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

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

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

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

m = A("m")
e = B("e")
c = C("c")
l = D("l")
i = E("i")
n = C("n")
b = C("b")

m.q = e
e.y = m
e.w = n
c.s = e
c.o = e
l.s = e
l.p = e
l.u = c
i.v = m
i.t = c
n.s = e
n.o = e
b.s = e
b.o = e
assert e.y.q.y.q.y.q.y.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.txt = txt

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

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

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

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

m = A("m")
e = B("e")
c = C("c")
l = D("l")
i = E("i")
n = C("n")
b = C("b")

m.q = e
e.y = m
e.w = n
c.s = e
c.o = e
l.s = e
l.p = e
l.u = c
i.v = m
i.t = c
n.s = e
n.o = e
b.s = e
b.o = e
assert e.y.q.y.q.y.q.y.txt == "m"