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

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

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

g = A("g")
m = B("m")
l = C("l")
j = B("j")
h = C("h")

g.t = j
g.s = m
g.v = h
m.t = l
l.t = g
l.y = h
j.t = l
h.t = g
h.y = l
assert g.s.t.t.v.y.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.s: B = None
        self.v: C = None
        self.txt = txt

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

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

g = A("g")
m = B("m")
l = C("l")
j = B("j")
h = C("h")

g.t = j
g.s = m
g.v = h
m.t = l
l.t = g
l.y = h
j.t = l
h.t = g
h.y = l
assert g.s.t.t.v.y.txt == "l"