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

class B:
    def __init__(self, txt: str):
        self.o: C = None
        self.z: A = None
        self.x: C = None
        self.p: D = None
        self.t: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.v: E = None
        self.w: D = None
        self.txt = txt

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

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

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

g.v = l
g.p = k
g.t = e
k.o = l
k.x = l
k.z = g
k.p = e
k.t = e
l.v = a
l.w = e
e.q = l
e.u = a
e.x = g
e.o = g
a.r = l
assert k.t.u.r.v.r.txt == "
class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.p: B = None
        self.t: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: C = None
        self.z: A = None
        self.x: C = None
        self.p: D = None
        self.t: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.v: E = None
        self.w: D = None
        self.txt = txt

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

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

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

g.v = l
g.p = k
g.t = e
k.o = l
k.x = l
k.z = g
k.p = e
k.t = e
l.v = a
l.w = e
e.q = l
e.u = a
e.x = g
e.o = g
a.r = l
assert k.t.u.r.v.r.txt == "l"