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

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

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

f = A("f")
e = B("e")
j = C("j")
g = B("g")
i = C("i")
d = A("d")

f.t = j
f.y = d
f.v = d
e.s = g
j.q = i
j.z = i
j.w = g
g.s = e
i.q = j
i.z = j
i.w = e
d.t = j
d.y = f
d.v = f
assert f.y.t.w.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.y: A = None
        self.v: A = None
        self.txt = txt

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

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

f = A("f")
e = B("e")
j = C("j")
g = B("g")
i = C("i")
d = A("d")

f.t = j
f.y = d
f.v = d
e.s = g
j.q = i
j.z = i
j.w = g
g.s = e
i.q = j
i.z = j
i.w = e
d.t = j
d.y = f
d.v = f
assert f.y.t.w.s.s.txt == "g"