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

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

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

k = A("k")
f = B("f")
h = C("h")
j = A("j")
b = A("b")
c = A("c")
i = B("i")
l = C("l")

k.s = h
f.r = b
f.x = i
h.y = f
h.z = f
h.u = l
j.s = h
b.s = h
c.s = h
i.r = c
i.x = f
l.y = i
l.z = f
l.u = h
assert l.u.u.z.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.txt = txt

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

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

k = A("k")
f = B("f")
h = C("h")
j = A("j")
b = A("b")
c = A("c")
i = B("i")
l = C("l")

k.s = h
f.r = b
f.x = i
h.y = f
h.z = f
h.u = l
j.s = h
b.s = h
c.s = h
i.r = c
i.x = f
l.y = i
l.z = f
l.u = h
assert l.u.u.z.x.x.txt == "f"