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

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

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

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

h.o = g
h.t = f
e.v = f
b.p = f
f.p = c
l.v = f
g.v = f
j.o = l
j.t = f
c.p = b
m.o = e
m.t = c
assert e.v.p.p.p.p.p.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.t: C = None
        self.txt = txt

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

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

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

h.o = g
h.t = f
e.v = f
b.p = f
f.p = c
l.v = f
g.v = f
j.o = l
j.t = f
c.p = b
m.o = e
m.t = c
assert e.v.p.p.p.p.p.txt == "b"