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

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

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

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

h.y = l
f.t = j
l.r = h
j.t = f
n.r = h
a.y = l
assert h.y.r.y.r.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.txt = txt

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

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

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

h.y = l
f.t = j
l.r = h
j.t = f
n.r = h
a.y = l
assert h.y.r.y.r.y.txt == "l"