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

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

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

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

b.o = f
b.u = j
b.w = j
h.v = j
j.p = c
j.o = f
j.y = i
i.v = j
f.o = b
f.u = j
f.w = j
c.v = j
assert b.o.u.p.v.txt == "
class A:
    def __init__(self, txt: str):
        self.o: A = None
        self.u: C = None
        self.w: C = None
        self.txt = txt

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

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

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

b.o = f
b.u = j
b.w = j
h.v = j
j.p = c
j.o = f
j.y = i
i.v = j
f.o = b
f.u = j
f.w = j
c.v = j
assert b.o.u.p.v.txt == "j"