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

class B:
    def __init__(self, txt: str):
        self.x: E = None
        self.o: C = None
        self.v: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.z: B = None
        self.u: C = None
        self.txt = txt

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

c = A("c")
k = B("k")
i = C("i")
g = D("g")
f = E("f")
n = B("n")
m = B("m")
h = D("h")
l = E("l")

c.r = l
k.x = l
k.o = i
k.v = i
i.p = n
g.z = k
g.u = i
f.p = l
f.x = l
f.r = k
f.o = g
n.x = l
n.o = i
n.v = i
m.x = f
m.o = i
m.v = i
h.z = n
h.u = i
l.p = f
l.x = f
l.r = n
l.o = g
assert k.x.o.z.o.p.v.txt == "
class A:
    def __init__(self, txt: str):
        self.r: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: E = None
        self.o: C = None
        self.v: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.z: B = None
        self.u: C = None
        self.txt = txt

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

c = A("c")
k = B("k")
i = C("i")
g = D("g")
f = E("f")
n = B("n")
m = B("m")
h = D("h")
l = E("l")

c.r = l
k.x = l
k.o = i
k.v = i
i.p = n
g.z = k
g.u = i
f.p = l
f.x = l
f.r = k
f.o = g
n.x = l
n.o = i
n.v = i
m.x = f
m.o = i
m.v = i
h.z = n
h.u = i
l.p = f
l.x = f
l.r = n
l.o = g
assert k.x.o.z.o.p.v.txt == "i"