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

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

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

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

a.y = e
e.w = f
e.o = f
e.p = f
h.u = a
f.w = e
f.o = e
f.p = e
assert a.y.o.p.p.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.txt = txt

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

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

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

a.y = e
e.w = f
e.o = f
e.p = f
h.u = a
f.w = e
f.o = e
f.p = e
assert a.y.o.p.p.txt == "f"