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

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

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

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

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

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

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

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

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

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

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

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

a.y = e
a.q = l
l.t = m
l.p = e
l.w = g
i.o = a
i.r = k
i.v = e
m.r = g
m.o = l
j.t = k
g.r = m
g.o = l
k.t = j
e.o = a
e.r = k
e.v = i
assert l.p.r.t.t.t.t.t.t.txt == "k"