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

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

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

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

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

f = A("f")
c = B("c")
e = C("e")
a = D("a")
k = E("k")
j = B("j")

f.o = a
f.v = k
f.x = e
f.p = c
f.w = j
c.r = k
c.x = k
c.z = j
c.p = e
e.p = f
e.s = f
e.r = a
e.o = a
e.x = k
a.y = k
a.q = c
k.q = e
j.r = k
j.x = k
j.z = c
j.p = e
assert e.p.v.q.p.v.q.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.v: E = None
        self.x: C = None
        self.p: B = None
        self.w: B = None
        self.txt = txt

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

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

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

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

f = A("f")
c = B("c")
e = C("e")
a = D("a")
k = E("k")
j = B("j")

f.o = a
f.v = k
f.x = e
f.p = c
f.w = j
c.r = k
c.x = k
c.z = j
c.p = e
e.p = f
e.s = f
e.r = a
e.o = a
e.x = k
a.y = k
a.q = c
k.q = e
j.r = k
j.x = k
j.z = c
j.p = e
assert e.p.v.q.p.v.q.txt == "e"