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

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

class C:
    def __init__(self, txt: str):
        self.w: D = None
        self.txt = txt

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

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

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

i.q = a
i.x = c
c.s = a
c.q = l
b.w = l
l.o = d
l.z = b
l.r = e
e.q = d
e.s = d
e.p = c
e.y = a
d.q = e
d.s = e
d.p = c
d.y = a
a.q = i
a.x = c
assert l.z.w.r.y.q.x.txt == "
class A:
    def __init__(self, txt: str):
        self.q: A = None
        self.x: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.w: D = None
        self.txt = txt

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

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

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

i.q = a
i.x = c
c.s = a
c.q = l
b.w = l
l.o = d
l.z = b
l.r = e
e.q = d
e.s = d
e.p = c
e.y = a
d.q = e
d.s = e
d.p = c
d.y = a
a.q = i
a.x = c
assert l.z.w.r.y.q.x.txt == "c"