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

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

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

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

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

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

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

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

n.p = l
e.y = f
e.r = h
e.w = n
l.v = i
l.t = h
i.p = l
f.y = e
f.r = h
f.w = a
a.p = l
h.y = f
h.r = e
h.w = a
assert i.p.t.y.r.txt == "h"