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

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

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

h = A("h")
n = B("n")
f = C("f")
b = B("b")
a = C("a")
d = A("d")

h.t = n
h.o = d
h.v = a
n.u = h
f.o = b
b.u = h
a.o = n
d.t = n
d.o = h
d.v = a
assert d.t.u.v.o.u.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.o: A = None
        self.v: C = None
        self.txt = txt

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

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

h = A("h")
n = B("n")
f = C("f")
b = B("b")
a = C("a")
d = A("d")

h.t = n
h.o = d
h.v = a
n.u = h
f.o = b
b.u = h
a.o = n
d.t = n
d.o = h
d.v = a
assert d.t.u.v.o.u.txt == "h"