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

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

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

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

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

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

e.r = n
a.v = e
a.y = e
a.p = b
a.t = n
a.w = g
g.r = n
b.p = a
j.t = i
j.s = l
j.w = l
n.r = e
i.r = n
d.p = l
l.v = i
l.t = i
l.y = n
l.p = d
l.w = g
k.t = e
k.s = a
k.w = a
assert j.s.y.r.r.r.r.r.r.r.r.txt == "
class A:
    def __init__(self, txt: str):
        self.r: A = None
        self.txt = txt

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

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

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

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

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

e.r = n
a.v = e
a.y = e
a.p = b
a.t = n
a.w = g
g.r = n
b.p = a
j.t = i
j.s = l
j.w = l
n.r = e
i.r = n
d.p = l
l.v = i
l.t = i
l.y = n
l.p = d
l.w = g
k.t = e
k.s = a
k.w = a
assert j.s.y.r.r.r.r.r.r.r.r.txt == "n"