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

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

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

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

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

c = A("c")
m = B("m")
f = C("f")
g = D("g")
k = E("k")

c.z = f
c.v = f
c.x = f
m.r = c
m.o = g
m.q = k
f.z = k
g.v = m
g.t = m
g.o = f
g.u = k
g.r = c
k.u = g
k.o = g
k.r = m
assert k.u.r.z.z.r.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.v: C = None
        self.x: C = None
        self.txt = txt

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

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

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

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

c = A("c")
m = B("m")
f = C("f")
g = D("g")
k = E("k")

c.z = f
c.v = f
c.x = f
m.r = c
m.o = g
m.q = k
f.z = k
g.v = m
g.t = m
g.o = f
g.u = k
g.r = c
k.u = g
k.o = g
k.r = m
assert k.u.r.z.z.r.txt == "m"