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

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

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

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

b = A("b")
i = B("i")
k = C("k")
n = D("n")
e = B("e")
l = C("l")
h = A("h")
c = D("c")

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

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

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

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

b = A("b")
i = B("i")
k = C("k")
n = D("n")
e = B("e")
l = C("l")
h = A("h")
c = D("c")

b.u = h
b.w = n
b.v = l
b.z = k
i.t = l
k.s = c
k.y = c
k.q = h
k.r = n
n.q = k
n.r = l
e.t = k
l.s = n
l.y = n
l.q = h
l.r = c
h.u = b
h.w = c
h.v = k
h.z = l
c.q = k
c.r = l
assert k.y.q.s.txt == "c"