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

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

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

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

l.p = f
l.w = b
i.x = n
i.v = f
f.z = e
f.r = l
f.x = n
n.p = f
n.w = b
b.z = e
b.r = e
b.x = l
h.x = l
h.v = b
e.p = b
e.w = f
assert l.w.r.w.x.w.z.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.w: C = None
        self.txt = txt

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

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

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

l.p = f
l.w = b
i.x = n
i.v = f
f.z = e
f.r = l
f.x = n
n.p = f
n.w = b
b.z = e
b.r = e
b.x = l
h.x = l
h.v = b
e.p = b
e.w = f
assert l.w.r.w.x.w.z.txt == "e"