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

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

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

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

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

l = A("l")
k = B("k")
e = C("e")
d = D("d")
g = E("g")
i = D("i")

l.q = e
l.t = e
k.q = l
k.x = l
k.y = d
k.o = d
e.r = k
e.t = l
d.v = e
d.t = e
g.w = i
g.x = e
g.q = e
g.y = e
i.v = e
i.t = e
assert g.q.t.t.r.x.t.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.t: C = None
        self.txt = txt

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

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

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

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

l = A("l")
k = B("k")
e = C("e")
d = D("d")
g = E("g")
i = D("i")

l.q = e
l.t = e
k.q = l
k.x = l
k.y = d
k.o = d
e.r = k
e.t = l
d.v = e
d.t = e
g.w = i
g.x = e
g.q = e
g.y = e
i.v = e
i.t = e
assert g.q.t.t.r.x.t.txt == "e"