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

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

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

class D:
    def __init__(self, txt: str):
        self.s: A = None
        self.v: A = None
        self.w: G = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.x: D = None
        self.z: A = None
        self.w: C = None
        self.o: A = None
        self.p: D = None
        self.txt = txt

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.s: A = None
        self.v: A = None
        self.w: G = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.x: D = None
        self.z: A = None
        self.w: C = None
        self.o: A = None
        self.p: D = None
        self.txt = txt

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

d.o = c
c.o = m
n.y = g
n.r = g
n.t = c
n.q = d
n.w = b
n.u = i
n.x = m
g.s = d
g.v = d
g.w = i
m.y = d
f.x = d
f.o = c
f.v = c
f.w = c
f.r = n
f.z = g
b.x = g
b.p = g
b.z = d
b.o = d
b.w = n
i.x = g
i.p = g
i.z = d
i.o = d
i.w = n
assert c.o.y.o.o.y.o.o.txt == "m"