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

class B:
    def __init__(self, txt: str):
        self.s: A = None
        self.u: E = None
        self.x: C = None
        self.p: C = None
        self.q: C = None
        self.txt = txt

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

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

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

i = A("i")
c = B("c")
e = C("e")
g = D("g")
f = E("f")
d = D("d")
m = A("m")

i.v = e
i.o = g
i.t = f
c.s = m
c.u = f
c.x = e
c.p = e
c.q = e
e.s = m
e.p = d
e.r = c
e.o = f
g.v = f
f.r = d
f.t = g
f.p = g
f.v = i
d.v = f
m.v = e
m.o = g
m.t = f
assert f.r.v.p.v.r.v.txt == "
class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.o: D = None
        self.t: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: A = None
        self.u: E = None
        self.x: C = None
        self.p: C = None
        self.q: C = None
        self.txt = txt

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

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

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

i = A("i")
c = B("c")
e = C("e")
g = D("g")
f = E("f")
d = D("d")
m = A("m")

i.v = e
i.o = g
i.t = f
c.s = m
c.u = f
c.x = e
c.p = e
c.q = e
e.s = m
e.p = d
e.r = c
e.o = f
g.v = f
f.r = d
f.t = g
f.p = g
f.v = i
d.v = f
m.v = e
m.o = g
m.t = f
assert f.r.v.p.v.r.v.txt == "f"