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

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

class C:
    def __init__(self, txt: str):
        self.v: A = None
        self.p: D = None
        self.y: B = None
        self.x: B = None
        self.t: D = None
        self.txt = txt

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

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

l = A("l")
e = B("e")
d = C("d")
j = D("j")
c = E("c")
k = D("k")
n = D("n")
a = E("a")

l.t = a
e.q = c
e.x = l
e.r = l
e.o = k
d.v = l
d.p = j
d.y = e
d.x = e
d.t = n
j.r = e
c.r = k
k.r = e
n.r = e
a.r = k
assert n.r.q.r.txt == "
class A:
    def __init__(self, txt: str):
        self.t: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.v: A = None
        self.p: D = None
        self.y: B = None
        self.x: B = None
        self.t: D = None
        self.txt = txt

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

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

l = A("l")
e = B("e")
d = C("d")
j = D("j")
c = E("c")
k = D("k")
n = D("n")
a = E("a")

l.t = a
e.q = c
e.x = l
e.r = l
e.o = k
d.v = l
d.p = j
d.y = e
d.x = e
d.t = n
j.r = e
c.r = k
k.r = e
n.r = e
a.r = k
assert n.r.q.r.txt == "k"