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

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

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

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

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

l = A("l")
a = B("a")
j = C("j")
m = D("m")
k = E("k")
d = A("d")
g = D("g")
i = C("i")
h = E("h")

l.q = d
a.t = d
j.w = d
m.s = g
k.x = h
d.q = l
g.s = m
i.w = l
h.x = k
assert d.q.q.q.q.q.q.q.q.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: A = None
        self.txt = txt

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

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

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

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

l = A("l")
a = B("a")
j = C("j")
m = D("m")
k = E("k")
d = A("d")
g = D("g")
i = C("i")
h = E("h")

l.q = d
a.t = d
j.w = d
m.s = g
k.x = h
d.q = l
g.s = m
i.w = l
h.x = k
assert d.q.q.q.q.q.q.q.q.q.txt == "l"