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

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

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

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

d.z = j
d.y = j
b.s = d
b.t = i
b.w = k
k.r = i
k.u = d
k.z = d
j.s = d
j.t = k
j.w = k
i.r = k
i.u = d
i.z = d
assert i.u.y.s.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.y: B = None
        self.txt = txt

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

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

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

d.z = j
d.y = j
b.s = d
b.t = i
b.w = k
k.r = i
k.u = d
k.z = d
j.s = d
j.t = k
j.w = k
i.r = k
i.u = d
i.z = d
assert i.u.y.s.txt == "d"