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

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

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

j = A("j")
i = B("i")
a = C("a")
h = B("h")
d = B("d")

j.p = h
i.o = d
i.r = d
i.u = h
a.s = d
a.v = j
a.p = j
h.o = d
h.u = d
h.r = i
d.o = h
d.r = i
d.u = i
assert h.u.o.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.txt = txt

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

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

j = A("j")
i = B("i")
a = C("a")
h = B("h")
d = B("d")

j.p = h
i.o = d
i.r = d
i.u = h
a.s = d
a.v = j
a.p = j
h.o = d
h.u = d
h.r = i
d.o = h
d.r = i
d.u = i
assert h.u.o.o.o.txt == "h"