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

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

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

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

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

b = A("b")
e = B("e")
k = C("k")
c = D("c")
n = E("n")
m = C("m")
a = E("a")
f = B("f")
i = A("i")

b.t = i
b.p = c
e.v = f
e.r = c
e.o = k
k.x = e
k.p = m
k.v = i
c.r = f
n.t = a
n.y = c
m.x = f
m.p = k
m.v = b
a.t = n
a.y = c
f.v = e
f.r = c
f.o = k
i.t = b
i.p = c
assert i.p.r.o.p.v.p.r.v.txt == "
class A:
    def __init__(self, txt: str):
        self.t: A = None
        self.p: D = None
        self.txt = txt

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

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

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

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

b = A("b")
e = B("e")
k = C("k")
c = D("c")
n = E("n")
m = C("m")
a = E("a")
f = B("f")
i = A("i")

b.t = i
b.p = c
e.v = f
e.r = c
e.o = k
k.x = e
k.p = m
k.v = i
c.r = f
n.t = a
n.y = c
m.x = f
m.p = k
m.v = b
a.t = n
a.y = c
f.v = e
f.r = c
f.o = k
i.t = b
i.p = c
assert i.p.r.o.p.v.p.r.v.txt == "e"