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

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

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

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

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

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

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

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

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