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

class B:
    def __init__(self, txt: str):
        self.u: E = None
        self.s: D = None
        self.t: D = None
        self.x: C = None
        self.txt = txt

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.u: E = None
        self.s: D = None
        self.t: D = None
        self.x: C = None
        self.txt = txt

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

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

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

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

a.v = b
b.u = g
b.s = c
b.t = n
b.x = k
i.t = k
i.y = b
i.r = b
i.o = g
c.r = g
g.y = b
g.s = b
g.v = n
g.t = a
g.p = a
k.t = i
k.y = b
k.r = b
k.o = g
n.r = g
assert n.r.s.u.v.r.txt == "g"