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

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

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

h = A("h")
b = B("b")
f = C("f")
e = B("e")
a = A("a")

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

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

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

h = A("h")
b = B("b")
f = C("f")
e = B("e")
a = A("a")

h.v = f
h.y = f
b.u = e
f.v = a
f.t = e
e.u = b
a.v = f
a.y = f
assert h.v.v.y.t.txt == "e"