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

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

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

h = A("h")
n = B("n")
d = C("d")
m = B("m")
j = B("j")

h.v = n
n.s = d
d.x = m
d.t = j
m.s = d
j.s = d
assert j.s.t.s.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.txt = txt

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

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

h = A("h")
n = B("n")
d = C("d")
m = B("m")
j = B("j")

h.v = n
n.s = d
d.x = m
d.t = j
m.s = d
j.s = d
assert j.s.t.s.txt == "d"