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

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

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

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

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

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

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

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

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

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

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

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

k.r = c
k.v = e
c.y = n
c.z = l
c.t = l
a.x = k
a.o = e
a.r = e
e.s = c
e.r = n
g.q = k
l.r = c
l.v = e
n.r = c
n.v = e
j.x = k
j.o = e
j.r = e
assert a.x.r.t.r.y.r.y.txt == "n"