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

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

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

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

g = A("g")
f = B("f")
n = C("n")
i = D("i")
a = D("a")
c = B("c")
m = B("m")
k = A("k")
e = D("e")

g.y = k
g.w = k
g.q = c
f.q = k
f.s = m
f.o = c
n.z = a
n.x = e
n.s = f
i.t = k
i.s = m
a.t = k
a.s = c
c.q = k
c.s = f
c.o = m
m.q = k
m.s = c
m.o = c
k.y = g
k.w = g
k.q = c
e.t = k
e.s = m
assert g.w.q.o.o.s.s.q.txt == "
class A:
    def __init__(self, txt: str):
        self.y: A = None
        self.q: B = None
        self.w: A = None
        self.txt = txt

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

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

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

g = A("g")
f = B("f")
n = C("n")
i = D("i")
a = D("a")
c = B("c")
m = B("m")
k = A("k")
e = D("e")

g.y = k
g.w = k
g.q = c
f.q = k
f.s = m
f.o = c
n.z = a
n.x = e
n.s = f
i.t = k
i.s = m
a.t = k
a.s = c
c.q = k
c.s = f
c.o = m
m.q = k
m.s = c
m.o = c
k.y = g
k.w = g
k.q = c
e.t = k
e.s = m
assert g.w.q.o.o.s.s.q.txt == "k"