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

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

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

a = A("a")
h = B("h")
c = C("c")
m = C("m")
e = A("e")
n = A("n")
f = C("f")
i = B("i")
b = B("b")

a.t = e
a.x = e
a.v = i
h.v = n
c.t = m
c.r = e
m.t = f
m.r = e
e.t = a
e.x = n
e.v = b
n.t = a
n.x = a
n.v = h
f.t = m
f.r = e
i.v = a
b.v = n
assert m.t.r.x.txt == "
class A:
    def __init__(self, txt: str):
        self.t: A = None
        self.x: A = None
        self.v: B = None
        self.txt = txt

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

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

a = A("a")
h = B("h")
c = C("c")
m = C("m")
e = A("e")
n = A("n")
f = C("f")
i = B("i")
b = B("b")

a.t = e
a.x = e
a.v = i
h.v = n
c.t = m
c.r = e
m.t = f
m.r = e
e.t = a
e.x = n
e.v = b
n.t = a
n.x = a
n.v = h
f.t = m
f.r = e
i.v = a
b.v = n
assert m.t.r.x.txt == "n"