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

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

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

d = A("d")
i = B("i")
l = C("l")
g = A("g")
j = B("j")

d.x = j
d.s = l
i.y = j
i.t = l
l.w = j
g.x = j
g.s = l
j.y = i
j.t = l
assert d.x.t.w.y.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.s: C = None
        self.txt = txt

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

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

d = A("d")
i = B("i")
l = C("l")
g = A("g")
j = B("j")

d.x = j
d.s = l
i.y = j
i.t = l
l.w = j
g.x = j
g.s = l
j.y = i
j.t = l
assert d.x.t.w.y.txt == "i"