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

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

class C:
    def __init__(self, txt: str):
        self.p: C = None
        self.x: D = None
        self.u: A = None
        self.w: B = None
        self.txt = txt

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

i = A("i")
n = B("n")
e = C("e")
b = D("b")
l = D("l")
f = C("f")

i.p = l
n.s = b
e.p = f
e.x = b
e.u = i
e.w = n
b.w = l
l.w = b
f.p = e
f.x = b
f.u = i
f.w = n
assert l.w.w.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.p: C = None
        self.x: D = None
        self.u: A = None
        self.w: B = None
        self.txt = txt

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

i = A("i")
n = B("n")
e = C("e")
b = D("b")
l = D("l")
f = C("f")

i.p = l
n.s = b
e.p = f
e.x = b
e.u = i
e.w = n
b.w = l
l.w = b
f.p = e
f.x = b
f.u = i
f.w = n
assert l.w.w.w.w.txt == "l"