class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.s: C = None
        self.x: E = None
        self.o: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.z: A = None
        self.s: A = None
        self.x: E = None
        self.w: B = None
        self.txt = txt

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

a = A("a")
n = B("n")
f = C("f")
d = D("d")
j = E("j")

a.z = n
a.s = f
a.o = f
a.x = j
n.q = j
n.u = a
n.p = a
f.q = a
f.s = n
d.z = a
d.s = a
d.x = j
d.w = n
j.x = f
j.s = a
assert f.s.q.x.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.s: C = None
        self.x: E = None
        self.o: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.z: A = None
        self.s: A = None
        self.x: E = None
        self.w: B = None
        self.txt = txt

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

a = A("a")
n = B("n")
f = C("f")
d = D("d")
j = E("j")

a.z = n
a.s = f
a.o = f
a.x = j
n.q = j
n.u = a
n.p = a
f.q = a
f.s = n
d.z = a
d.s = a
d.x = j
d.w = n
j.x = f
j.s = a
assert f.s.q.x.txt == "f"