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

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

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

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

c.v = h
c.t = j
h.s = j
a.v = f
f.s = j
j.v = h
j.t = c
g.v = f
n.v = h
n.t = j
assert h.s.v.s.t.v.s.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.t: A = None
        self.txt = txt

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

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

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

c.v = h
c.t = j
h.s = j
a.v = f
f.s = j
j.v = h
j.t = c
g.v = f
n.v = h
n.t = j
assert h.s.v.s.t.v.s.txt == "j"