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

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

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

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

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

a.s = c
a.q = k
a.w = b
c.w = b
c.r = a
b.p = m
b.t = n
k.z = c
k.u = l
k.x = n
k.y = n
m.z = c
m.u = l
m.x = n
m.y = n
i.s = c
i.q = k
i.w = b
l.s = c
l.q = k
l.w = b
n.z = c
n.u = a
n.x = m
n.y = k
assert i.q.u.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.q: D = None
        self.w: C = None
        self.txt = txt

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

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

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

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

a.s = c
a.q = k
a.w = b
c.w = b
c.r = a
b.p = m
b.t = n
k.z = c
k.u = l
k.x = n
k.y = n
m.z = c
m.u = l
m.x = n
m.y = n
i.s = c
i.q = k
i.w = b
l.s = c
l.q = k
l.w = b
n.z = c
n.u = a
n.x = m
n.y = k
assert i.q.u.s.txt == "c"