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

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

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

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

class E:
    def __init__(self, txt: str):
        self.x: A = None
        self.u: E = None
        self.o: A = None
        self.z: B = None
        self.r: C = None
        self.txt = txt

a = A("a")
k = B("k")
e = C("e")
h = D("h")
b = E("b")
c = E("c")
m = D("m")

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.x: A = None
        self.u: E = None
        self.o: A = None
        self.z: B = None
        self.r: C = None
        self.txt = txt

a = A("a")
k = B("k")
e = C("e")
h = D("h")
b = E("b")
c = E("c")
m = D("m")

a.x = e
a.v = k
a.p = h
k.w = h
k.u = m
k.r = c
e.t = m
e.r = h
e.p = k
e.v = a
h.x = c
h.z = b
b.x = a
b.o = a
b.u = c
b.z = k
b.r = e
c.x = a
c.o = a
c.u = b
c.z = k
c.r = e
m.x = c
m.z = b
assert b.u.r.v.txt == "a"