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

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

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

class D:
    def __init__(self, txt: str):
        self.u: B = None
        self.w: B = None
        self.p: C = None
        self.q: C = None
        self.txt = txt

f = A("f")
c = B("c")
b = C("b")
k = D("k")
l = D("l")

f.y = k
f.u = b
f.v = c
c.y = l
b.u = k
b.x = f
k.u = c
k.w = c
k.p = b
k.q = b
l.u = c
l.w = c
l.p = b
l.q = b
assert c.y.u.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.u: C = None
        self.v: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.u: B = None
        self.w: B = None
        self.p: C = None
        self.q: C = None
        self.txt = txt

f = A("f")
c = B("c")
b = C("b")
k = D("k")
l = D("l")

f.y = k
f.u = b
f.v = c
c.y = l
b.u = k
b.x = f
k.u = c
k.w = c
k.p = b
k.q = b
l.u = c
l.w = c
l.p = b
l.q = b
assert c.y.u.y.txt == "l"