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

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

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

k = A("k")
n = B("n")
g = C("g")
d = A("d")
j = C("j")
f = B("f")
c = A("c")

k.s = g
k.x = j
n.u = j
g.w = f
g.u = j
g.r = c
d.s = g
d.x = j
j.w = n
j.u = g
j.r = d
f.u = g
c.s = g
c.x = j
assert k.s.u.u.r.x.w.u.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.x: C = None
        self.txt = txt

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

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

k = A("k")
n = B("n")
g = C("g")
d = A("d")
j = C("j")
f = B("f")
c = A("c")

k.s = g
k.x = j
n.u = j
g.w = f
g.u = j
g.r = c
d.s = g
d.x = j
j.w = n
j.u = g
j.r = d
f.u = g
c.s = g
c.x = j
assert k.s.u.u.r.x.w.u.txt == "j"