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

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

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

a = A("a")
h = B("h")
i = C("i")
j = B("j")
g = C("g")
m = C("m")
c = C("c")
f = C("f")

a.t = h
a.v = m
h.w = a
i.u = a
i.y = a
j.w = a
g.u = a
g.y = a
m.u = a
m.y = a
c.u = a
c.y = a
f.u = a
f.y = a
assert m.y.t.w.v.u.t.w.v.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.v: C = None
        self.txt = txt

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

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

a = A("a")
h = B("h")
i = C("i")
j = B("j")
g = C("g")
m = C("m")
c = C("c")
f = C("f")

a.t = h
a.v = m
h.w = a
i.u = a
i.y = a
j.w = a
g.u = a
g.y = a
m.u = a
m.y = a
c.u = a
c.y = a
f.u = a
f.y = a
assert m.y.t.w.v.u.t.w.v.txt == "m"