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

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

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

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

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

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

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

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

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

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

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