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

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

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

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

class E:
    def __init__(self, txt: str):
        self.t: F = None
        self.s: C = None
        self.p: F = None
        self.r: B = None
        self.o: G = None
        self.v: A = None
        self.w: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.o: B = None
        self.s: D = None
        self.r: G = None
        self.t: B = None
        self.q: E = None
        self.x: E = None
        self.txt = txt

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

m = A("m")
g = B("g")
l = C("l")
k = D("k")
i = E("i")
c = F("c")
f = G("f")

m.o = f
m.w = g
g.o = m
l.t = c
l.z = m
l.o = f
l.r = f
l.v = f
k.w = f
k.o = l
k.q = i
i.t = c
i.p = c
i.s = l
i.r = g
i.w = g
i.o = f
i.v = m
c.o = g
c.t = g
c.s = k
c.r = f
c.q = i
c.x = i
f.x = g
assert f.x.o.w.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: G = None
        self.w: B = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.t: F = None
        self.s: C = None
        self.p: F = None
        self.r: B = None
        self.o: G = None
        self.v: A = None
        self.w: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.o: B = None
        self.s: D = None
        self.r: G = None
        self.t: B = None
        self.q: E = None
        self.x: E = None
        self.txt = txt

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

m = A("m")
g = B("g")
l = C("l")
k = D("k")
i = E("i")
c = F("c")
f = G("f")

m.o = f
m.w = g
g.o = m
l.t = c
l.z = m
l.o = f
l.r = f
l.v = f
k.w = f
k.o = l
k.q = i
i.t = c
i.p = c
i.s = l
i.r = g
i.w = g
i.o = f
i.v = m
c.o = g
c.t = g
c.s = k
c.r = f
c.q = i
c.x = i
f.x = g
assert f.x.o.w.o.txt == "m"