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

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

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

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

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

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

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

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

f.x = h
f.u = h
f.t = a
h.p = n
a.v = l
a.r = l
n.x = h
n.u = h
n.t = a
l.x = h
l.u = h
l.t = a
assert a.v.x.p.txt == "n"