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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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