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

class B:
    def __init__(self, txt: str):
        self.r: D = None
        self.t: C = None
        self.txt = txt

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

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

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

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

l.q = a
k.r = a
k.t = h
i.r = h
i.o = b
i.z = a
i.q = e
i.x = e
a.t = k
c.v = b
c.s = k
h.r = b
h.o = i
h.z = a
h.q = e
h.x = e
e.q = a
b.r = h
b.o = h
b.z = a
b.q = l
b.x = e
assert c.s.r.t.r.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: D = None
        self.t: C = None
        self.txt = txt

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

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

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

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

l.q = a
k.r = a
k.t = h
i.r = h
i.o = b
i.z = a
i.q = e
i.x = e
a.t = k
c.v = b
c.s = k
h.r = b
h.o = i
h.z = a
h.q = e
h.x = e
e.q = a
b.r = h
b.o = h
b.z = a
b.q = l
b.x = e
assert c.s.r.t.r.txt == "a"