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

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

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

b = A("b")
k = B("k")
a = C("a")
h = B("h")
f = B("f")
i = C("i")
e = A("e")
n = C("n")
l = B("l")
j = B("j")

b.t = l
k.x = b
a.p = b
a.y = n
a.w = i
h.x = b
f.x = b
i.p = b
i.y = n
i.w = a
e.t = j
n.p = e
n.y = a
n.w = a
l.x = b
j.x = b
assert k.x.t.x.t.x.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.txt = txt

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

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

b = A("b")
k = B("k")
a = C("a")
h = B("h")
f = B("f")
i = C("i")
e = A("e")
n = C("n")
l = B("l")
j = B("j")

b.t = l
k.x = b
a.p = b
a.y = n
a.w = i
h.x = b
f.x = b
i.p = b
i.y = n
i.w = a
e.t = j
n.p = e
n.y = a
n.w = a
l.x = b
j.x = b
assert k.x.t.x.t.x.t.txt == "l"