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

class B:
    def __init__(self, txt: str):
        self.r: C = None
        self.s: A = None
        self.u: C = None
        self.z: D = None
        self.txt = txt

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

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

f = A("f")
l = B("l")
b = C("b")
h = D("h")

f.p = l
f.y = l
f.q = b
f.o = h
l.r = b
l.u = b
l.s = f
l.z = h
b.v = h
b.x = f
h.y = l
assert f.q.v.y.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.y: B = None
        self.q: C = None
        self.o: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: C = None
        self.s: A = None
        self.u: C = None
        self.z: D = None
        self.txt = txt

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

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

f = A("f")
l = B("l")
b = C("b")
h = D("h")

f.p = l
f.y = l
f.q = b
f.o = h
l.r = b
l.u = b
l.s = f
l.z = h
b.v = h
b.x = f
h.y = l
assert f.q.v.y.txt == "l"