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

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

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

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

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

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

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

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

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

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

k.x = a
k.p = b
k.y = i
g.u = a
g.s = e
m.y = a
m.p = l
m.w = g
m.q = k
l.q = c
l.s = g
l.z = k
l.y = k
e.y = g
e.p = c
e.w = a
e.q = i
a.u = g
a.s = e
b.q = l
b.s = a
b.z = k
b.y = k
i.x = a
i.p = c
i.y = k
c.q = l
c.s = a
c.z = i
c.y = k
assert m.y.s.w.u.s.txt == "e"