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

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

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

b = A("b")
i = B("i")
k = C("k")
d = C("d")
j = A("j")
h = A("h")
f = C("f")

b.p = f
b.v = k
i.o = f
i.y = b
k.s = d
k.t = d
k.o = h
d.s = f
d.t = f
d.o = h
j.p = f
j.v = k
h.p = k
h.v = k
f.s = d
f.t = d
f.o = h
assert h.v.o.p.s.s.t.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.v: C = None
        self.txt = txt

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

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

b = A("b")
i = B("i")
k = C("k")
d = C("d")
j = A("j")
h = A("h")
f = C("f")

b.p = f
b.v = k
i.o = f
i.y = b
k.s = d
k.t = d
k.o = h
d.s = f
d.t = f
d.o = h
j.p = f
j.v = k
h.p = k
h.v = k
f.s = d
f.t = d
f.o = h
assert h.v.o.p.s.s.t.txt == "d"