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

class B:
    def __init__(self, txt: str):
        self.v: E = None
        self.t: C = None
        self.s: E = None
        self.o: C = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.s: A = None
        self.y: B = None
        self.r: B = None
        self.w: D = None
        self.x: C = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.v: E = None
        self.t: C = None
        self.s: E = None
        self.o: C = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.s: A = None
        self.y: B = None
        self.r: B = None
        self.w: D = None
        self.x: C = None
        self.txt = txt

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

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