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

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

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

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

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

c.q = a
l.o = a
l.y = k
l.t = c
l.w = h
h.y = i
h.p = l
h.u = m
n.v = k
b.q = l
k.v = n
m.q = l
a.o = l
a.y = n
a.t = c
a.w = h
i.y = h
i.p = l
i.u = b
assert c.q.o.w.y.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.txt = txt

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

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

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

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

c.q = a
l.o = a
l.y = k
l.t = c
l.w = h
h.y = i
h.p = l
h.u = m
n.v = k
b.q = l
k.v = n
m.q = l
a.o = l
a.y = n
a.t = c
a.w = h
i.y = h
i.p = l
i.u = b
assert c.q.o.w.y.txt == "i"