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

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

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

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

k = A("k")
b = B("b")
i = C("i")
n = D("n")
c = A("c")
m = A("m")

k.x = i
k.w = i
k.y = m
k.o = n
b.q = n
i.y = n
n.r = b
n.o = k
n.s = c
c.x = i
c.w = i
c.y = k
c.o = n
m.x = i
m.w = i
m.y = c
m.o = n
assert c.x.y.r.q.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.w: C = None
        self.y: A = None
        self.o: D = None
        self.txt = txt

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

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

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

k = A("k")
b = B("b")
i = C("i")
n = D("n")
c = A("c")
m = A("m")

k.x = i
k.w = i
k.y = m
k.o = n
b.q = n
i.y = n
n.r = b
n.o = k
n.s = c
c.x = i
c.w = i
c.y = k
c.o = n
m.x = i
m.w = i
m.y = c
m.o = n
assert c.x.y.r.q.txt == "n"