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

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

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

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

k = A("k")
a = B("a")
j = C("j")
i = D("i")
c = A("c")
b = B("b")
h = C("h")

k.q = h
k.o = h
k.s = a
k.y = i
a.s = b
a.z = k
a.y = i
a.q = c
j.u = b
j.p = b
i.s = a
i.p = a
i.y = h
i.u = h
c.q = h
c.o = h
c.s = a
c.y = i
b.s = a
b.z = c
b.q = c
b.y = i
h.u = b
h.p = b
assert j.u.s.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.o: C = None
        self.s: B = None
        self.y: D = None
        self.txt = txt

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

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

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

k = A("k")
a = B("a")
j = C("j")
i = D("i")
c = A("c")
b = B("b")
h = C("h")

k.q = h
k.o = h
k.s = a
k.y = i
a.s = b
a.z = k
a.y = i
a.q = c
j.u = b
j.p = b
i.s = a
i.p = a
i.y = h
i.u = h
c.q = h
c.o = h
c.s = a
c.y = i
b.s = a
b.z = c
b.q = c
b.y = i
h.u = b
h.p = b
assert j.u.s.q.txt == "c"