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

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

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

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

h = A("h")
k = B("k")
b = C("b")
j = D("j")
d = A("d")
g = D("g")
e = A("e")
i = B("i")

h.q = e
h.s = k
h.o = g
h.w = d
k.w = e
k.q = j
k.o = d
b.w = i
j.r = e
d.q = e
d.s = k
d.o = g
d.w = h
g.r = h
e.q = d
e.s = k
e.o = g
e.w = h
i.w = e
i.q = j
i.o = h
assert h.w.w.s.txt == "
class A:
    def __init__(self, txt: str):
        self.q: A = None
        self.s: B = None
        self.o: D = None
        self.w: A = None
        self.txt = txt

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

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

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

h = A("h")
k = B("k")
b = C("b")
j = D("j")
d = A("d")
g = D("g")
e = A("e")
i = B("i")

h.q = e
h.s = k
h.o = g
h.w = d
k.w = e
k.q = j
k.o = d
b.w = i
j.r = e
d.q = e
d.s = k
d.o = g
d.w = h
g.r = h
e.q = d
e.s = k
e.o = g
e.w = h
i.w = e
i.q = j
i.o = h
assert h.w.w.s.txt == "k"