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

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

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

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

f.u = e
f.v = e
f.p = d
n.x = d
e.r = n
e.w = l
e.p = d
a.r = d
a.p = d
a.w = l
d.x = n
l.r = d
l.p = d
l.w = a
i.u = l
i.p = d
i.v = a
assert f.u.r.x.x.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.p: B = None
        self.v: C = None
        self.txt = txt

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

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

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

f.u = e
f.v = e
f.p = d
n.x = d
e.r = n
e.w = l
e.p = d
a.r = d
a.p = d
a.w = l
d.x = n
l.r = d
l.p = d
l.w = a
i.u = l
i.p = d
i.v = a
assert f.u.r.x.x.x.x.txt == "n"