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

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

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

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

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

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

a.p = c
a.q = c
a.x = c
a.t = k
a.s = k
f.v = d
c.w = d
k.v = d
k.x = d
k.u = d
k.z = a
k.o = f
d.t = k
d.o = c
d.x = c
d.u = a
d.w = f
assert a.q.w.o.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.t: D = None
        self.q: C = None
        self.s: D = None
        self.x: C = None
        self.txt = txt

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

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

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

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

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

a.p = c
a.q = c
a.x = c
a.t = k
a.s = k
f.v = d
c.w = d
k.v = d
k.x = d
k.u = d
k.z = a
k.o = f
d.t = k
d.o = c
d.x = c
d.u = a
d.w = f
assert a.q.w.o.txt == "c"