class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.z: B = None
        self.u: D = None
        self.t: D = None
        self.txt = txt

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

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

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

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

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

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

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

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

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

f.p = n
f.u = n
f.t = n
f.z = e
e.w = n
e.q = n
k.z = e
k.y = a
a.s = f
a.o = f
a.p = e
a.x = e
l.p = a
l.u = a
l.t = a
l.z = e
n.s = l
n.p = e
n.x = e
n.o = f
assert n.x.w.o.t.txt == "n"