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

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

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

class D:
    def __init__(self, txt: str):
        self.y: F = None
        self.u: G = None
        self.r: E = None
        self.z: B = None
        self.o: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.r: F = None
        self.y: D = None
        self.z: F = None
        self.w: F = None
        self.t: A = None
        self.u: D = None
        self.x: G = None
        self.txt = txt

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

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

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.y: F = None
        self.u: G = None
        self.r: E = None
        self.z: B = None
        self.o: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.r: F = None
        self.y: D = None
        self.z: F = None
        self.w: F = None
        self.t: A = None
        self.u: D = None
        self.x: G = None
        self.txt = txt

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

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

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

m.q = n
m.x = i
e.w = b
e.o = m
n.u = m
b.y = i
b.u = g
b.o = g
b.r = a
b.z = e
a.r = i
a.z = i
a.w = i
a.y = b
a.u = b
a.t = m
a.x = g
i.w = a
i.p = g
i.u = b
g.u = e
assert g.u.o.q.u.q.u.txt == "m"