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

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

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

d = A("d")
k = B("k")
j = C("j")

d.z = j
d.u = k
k.y = j
k.x = j
j.s = k
assert k.y.s.y.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.u: B = None
        self.txt = txt

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

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

d = A("d")
k = B("k")
j = C("j")

d.z = j
d.u = k
k.y = j
k.x = j
j.s = k
assert k.y.s.y.txt == "j"