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

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

class C:
    def __init__(self, txt: str):
        self.p: D = None
        self.q: D = None
        self.z: A = None
        self.o: A = None
        self.txt = txt

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

e = A("e")
b = B("b")
k = C("k")
l = D("l")
f = D("f")

e.p = b
e.q = l
e.y = l
e.x = l
b.s = f
b.z = l
b.u = k
k.p = f
k.q = f
k.z = e
k.o = e
l.q = e
l.o = e
l.x = k
l.s = b
f.q = e
f.o = e
f.x = k
f.s = b
assert l.x.z.p.z.s.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.q: D = None
        self.y: D = None
        self.x: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.p: D = None
        self.q: D = None
        self.z: A = None
        self.o: A = None
        self.txt = txt

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

e = A("e")
b = B("b")
k = C("k")
l = D("l")
f = D("f")

e.p = b
e.q = l
e.y = l
e.x = l
b.s = f
b.z = l
b.u = k
k.p = f
k.q = f
k.z = e
k.o = e
l.q = e
l.o = e
l.x = k
l.s = b
f.q = e
f.o = e
f.x = k
f.s = b
assert l.x.z.p.z.s.txt == "b"