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

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

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

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

m = A("m")
g = B("g")
e = C("e")
b = D("b")
n = A("n")
i = C("i")
a = A("a")
l = A("l")
j = B("j")

m.p = i
m.y = l
m.s = e
g.p = j
g.y = b
g.w = a
g.z = e
e.q = b
e.o = i
e.t = i
b.y = i
b.w = g
n.p = i
n.y = a
n.s = e
i.q = b
i.o = e
i.t = e
a.p = i
a.s = i
a.y = n
l.p = i
l.y = n
l.s = e
j.p = g
j.y = b
j.w = a
j.z = i
assert m.p.o.t.t.t.o.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.y: A = None
        self.s: C = None
        self.txt = txt

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

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

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

m = A("m")
g = B("g")
e = C("e")
b = D("b")
n = A("n")
i = C("i")
a = A("a")
l = A("l")
j = B("j")

m.p = i
m.y = l
m.s = e
g.p = j
g.y = b
g.w = a
g.z = e
e.q = b
e.o = i
e.t = i
b.y = i
b.w = g
n.p = i
n.y = a
n.s = e
i.q = b
i.o = e
i.t = e
a.p = i
a.s = i
a.y = n
l.p = i
l.y = n
l.s = e
j.p = g
j.y = b
j.w = a
j.z = i
assert m.p.o.t.t.t.o.txt == "e"