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

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

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

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

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

a = A("a")
i = B("i")
f = C("f")
b = D("b")
j = E("j")
k = A("k")

a.s = k
a.v = k
a.o = b
a.r = b
i.s = b
f.v = k
f.s = k
b.s = a
b.u = k
b.x = f
b.q = i
j.q = f
j.o = f
j.x = f
j.v = b
k.s = a
k.v = a
k.o = b
k.r = b
assert j.v.x.v.s.v.txt == "
class A:
    def __init__(self, txt: str):
        self.s: A = None
        self.v: A = None
        self.o: D = None
        self.r: D = None
        self.txt = txt

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

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

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

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

a = A("a")
i = B("i")
f = C("f")
b = D("b")
j = E("j")
k = A("k")

a.s = k
a.v = k
a.o = b
a.r = b
i.s = b
f.v = k
f.s = k
b.s = a
b.u = k
b.x = f
b.q = i
j.q = f
j.o = f
j.x = f
j.v = b
k.s = a
k.v = a
k.o = b
k.r = b
assert j.v.x.v.s.v.txt == "k"