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

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

class C:
    def __init__(self, txt: str):
        self.w: A = None
        self.x: B = None
        self.p: B = None
        self.txt = txt

e = A("e")
k = B("k")
l = C("l")
j = C("j")
f = C("f")

e.u = k
e.q = k
k.s = j
k.w = e
l.w = e
l.x = k
l.p = k
j.w = e
j.x = k
j.p = k
f.w = e
f.x = k
f.p = k
assert k.s.w.q.w.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.q: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.w: A = None
        self.x: B = None
        self.p: B = None
        self.txt = txt

e = A("e")
k = B("k")
l = C("l")
j = C("j")
f = C("f")

e.u = k
e.q = k
k.s = j
k.w = e
l.w = e
l.x = k
l.p = k
j.w = e
j.x = k
j.p = k
f.w = e
f.x = k
f.p = k
assert k.s.w.q.w.u.txt == "k"