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

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

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

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

c = A("c")
k = B("k")
l = C("l")
m = D("m")

c.u = l
c.o = m
c.q = m
k.s = m
l.y = k
m.p = l
assert c.o.p.y.s.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.o: D = None
        self.q: D = None
        self.txt = txt

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

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

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

c = A("c")
k = B("k")
l = C("l")
m = D("m")

c.u = l
c.o = m
c.q = m
k.s = m
l.y = k
m.p = l
assert c.o.p.y.s.txt == "m"