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

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

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

class D:
    def __init__(self, txt: str):
        self.r: C = None
        self.y: B = None
        self.txt = txt

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.r: C = None
        self.y: B = None
        self.txt = txt

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

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