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

class B:
    def __init__(self, txt: str):
        self.r: E = None
        self.t: G = None
        self.w: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.t: B = None
        self.o: B = None
        self.q: F = None
        self.u: G = None
        self.r: A = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.v: B = None
        self.y: A = None
        self.t: E = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.o: D = None
        self.txt = txt

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

m.o = i
m.q = a
i.r = b
i.t = c
i.w = f
n.t = i
n.o = i
n.q = f
n.u = c
n.r = m
l.z = i
l.u = n
j.v = i
j.y = a
j.t = b
f.q = i
f.o = m
c.o = g
b.v = i
b.y = m
b.t = j
a.o = i
a.q = m
g.z = i
g.u = n
assert a.o.r.t.y.q.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.q: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: E = None
        self.t: G = None
        self.w: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.t: B = None
        self.o: B = None
        self.q: F = None
        self.u: G = None
        self.r: A = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.v: B = None
        self.y: A = None
        self.t: E = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.o: D = None
        self.txt = txt

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

m.o = i
m.q = a
i.r = b
i.t = c
i.w = f
n.t = i
n.o = i
n.q = f
n.u = c
n.r = m
l.z = i
l.u = n
j.v = i
j.y = a
j.t = b
f.q = i
f.o = m
c.o = g
b.v = i
b.y = m
b.t = j
a.o = i
a.q = m
g.z = i
g.u = n
assert a.o.r.t.y.q.txt == "m"