class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.u: C = None
        self.x: D = None
        self.o: C = None
        self.txt = txt

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

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

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

k = A("k")
l = B("l")
a = C("a")
i = D("i")
j = A("j")
h = C("h")
f = A("f")
g = C("g")

k.s = i
k.x = i
k.u = a
k.o = g
l.t = h
l.p = a
a.q = h
a.w = i
a.t = l
i.o = f
i.q = h
i.w = k
i.p = a
j.s = i
j.x = i
j.u = a
j.o = h
h.q = a
h.w = i
h.t = l
f.s = i
f.x = i
f.u = h
f.o = g
g.q = h
g.w = i
g.t = l
assert i.o.s.p.txt == "
class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.u: C = None
        self.x: D = None
        self.o: C = None
        self.txt = txt

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

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

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

k = A("k")
l = B("l")
a = C("a")
i = D("i")
j = A("j")
h = C("h")
f = A("f")
g = C("g")

k.s = i
k.x = i
k.u = a
k.o = g
l.t = h
l.p = a
a.q = h
a.w = i
a.t = l
i.o = f
i.q = h
i.w = k
i.p = a
j.s = i
j.x = i
j.u = a
j.o = h
h.q = a
h.w = i
h.t = l
f.s = i
f.x = i
f.u = h
f.o = g
g.q = h
g.w = i
g.t = l
assert i.o.s.p.txt == "a"