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

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

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

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

l.w = n
f.t = n
n.x = j
e.t = n
h.w = n
j.w = n
assert n.x.w.x.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.txt = txt

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

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

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

l.w = n
f.t = n
n.x = j
e.t = n
h.w = n
j.w = n
assert n.x.w.x.txt == "j"