class A:
    def __init__(self, txt: str):
        self.o: G = None
        self.x: B = None
        self.r: F = None
        self.w: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: E = None
        self.o: A = None
        self.w: F = None
        self.y: F = None
        self.s: G = None
        self.x: E = None
        self.p: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.w: E = None
        self.x: C = None
        self.txt = txt

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

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

m.o = i
m.x = c
m.r = n
m.w = g
c.z = g
a.u = n
g.s = a
f.u = e
f.x = e
f.o = m
f.w = n
f.y = n
f.s = i
f.p = g
n.w = e
n.x = a
i.z = m
i.y = g
e.u = f
e.x = f
e.o = m
e.w = n
e.y = n
e.s = i
e.p = g
assert g.s.u.x.u.x.u.w.txt == "
class A:
    def __init__(self, txt: str):
        self.o: G = None
        self.x: B = None
        self.r: F = None
        self.w: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: E = None
        self.o: A = None
        self.w: F = None
        self.y: F = None
        self.s: G = None
        self.x: E = None
        self.p: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.w: E = None
        self.x: C = None
        self.txt = txt

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

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

m.o = i
m.x = c
m.r = n
m.w = g
c.z = g
a.u = n
g.s = a
f.u = e
f.x = e
f.o = m
f.w = n
f.y = n
f.s = i
f.p = g
n.w = e
n.x = a
i.z = m
i.y = g
e.u = f
e.x = f
e.o = m
e.w = n
e.y = n
e.s = i
e.p = g
assert g.s.u.x.u.x.u.w.txt == "e"