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

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

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

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

g = A("g")
i = B("i")
c = C("c")
h = D("h")
m = D("m")
j = C("j")
a = A("a")
l = C("l")
d = B("d")

g.u = c
g.w = i
g.s = i
i.x = d
i.o = d
i.s = g
c.z = l
c.x = m
c.w = i
c.o = g
h.s = m
h.t = m
h.p = l
h.q = j
m.s = h
m.t = h
m.p = l
m.q = l
j.z = l
j.x = m
j.w = d
j.o = a
a.u = l
a.w = i
a.s = d
l.z = j
l.x = h
l.w = d
l.o = a
d.x = i
d.o = i
d.s = a
assert i.s.s.o.x.x.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.w: B = None
        self.s: B = None
        self.txt = txt

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

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

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

g = A("g")
i = B("i")
c = C("c")
h = D("h")
m = D("m")
j = C("j")
a = A("a")
l = C("l")
d = B("d")

g.u = c
g.w = i
g.s = i
i.x = d
i.o = d
i.s = g
c.z = l
c.x = m
c.w = i
c.o = g
h.s = m
h.t = m
h.p = l
h.q = j
m.s = h
m.t = h
m.p = l
m.q = l
j.z = l
j.x = m
j.w = d
j.o = a
a.u = l
a.w = i
a.s = d
l.z = j
l.x = h
l.w = d
l.o = a
d.x = i
d.o = i
d.s = a
assert i.s.s.o.x.x.s.s.txt == "d"