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

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

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

c = A("c")
f = B("f")
d = C("d")
a = C("a")
l = B("l")
h = C("h")
m = C("m")
g = B("g")

c.v = f
c.p = f
f.r = g
f.u = l
d.t = c
a.t = c
l.r = f
l.u = f
h.t = c
m.t = c
g.r = f
g.u = l
assert f.r.u.u.u.r.u.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.p: B = None
        self.txt = txt

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

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

c = A("c")
f = B("f")
d = C("d")
a = C("a")
l = B("l")
h = C("h")
m = C("m")
g = B("g")

c.v = f
c.p = f
f.r = g
f.u = l
d.t = c
a.t = c
l.r = f
l.u = f
h.t = c
m.t = c
g.r = f
g.u = l
assert f.r.u.u.u.r.u.txt == "l"