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

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

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

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

m = A("m")
e = B("e")
k = C("k")
g = D("g")
a = B("a")
l = C("l")
i = C("i")

m.u = e
m.x = g
m.s = i
m.q = a
e.z = i
e.o = g
k.z = e
k.y = g
k.p = m
g.q = k
g.r = k
g.s = i
g.v = l
a.z = l
a.o = g
l.z = e
l.y = g
l.p = m
i.z = e
i.y = g
i.p = m
assert g.q.z.o.q.p.q.o.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.x: D = None
        self.s: C = None
        self.q: B = None
        self.txt = txt

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

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

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

m = A("m")
e = B("e")
k = C("k")
g = D("g")
a = B("a")
l = C("l")
i = C("i")

m.u = e
m.x = g
m.s = i
m.q = a
e.z = i
e.o = g
k.z = e
k.y = g
k.p = m
g.q = k
g.r = k
g.s = i
g.v = l
a.z = l
a.o = g
l.z = e
l.y = g
l.p = m
i.z = e
i.y = g
i.p = m
assert g.q.z.o.q.p.q.o.txt == "g"