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

class B:
    def __init__(self, txt: str):
        self.t: F = None
        self.q: F = None
        self.w: D = None
        self.p: C = None
        self.v: D = None
        self.txt = txt

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

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

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

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

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

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

n.w = d
n.t = d
n.z = f
n.o = j
n.q = g
n.r = c
m.t = d
m.q = d
m.w = c
m.v = c
m.p = f
f.o = c
f.q = d
f.u = j
c.z = e
c.v = e
c.w = j
c.q = j
e.o = c
d.t = f
d.x = g
j.p = d
g.w = d
g.t = d
g.z = f
g.o = j
g.q = n
g.r = c
assert g.q.z.o.z.o.v.o.txt == "
class A:
    def __init__(self, txt: str):
        self.w: F = None
        self.z: C = None
        self.o: G = None
        self.t: F = None
        self.q: A = None
        self.r: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: F = None
        self.q: F = None
        self.w: D = None
        self.p: C = None
        self.v: D = None
        self.txt = txt

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

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

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

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

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

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

n.w = d
n.t = d
n.z = f
n.o = j
n.q = g
n.r = c
m.t = d
m.q = d
m.w = c
m.v = c
m.p = f
f.o = c
f.q = d
f.u = j
c.z = e
c.v = e
c.w = j
c.q = j
e.o = c
d.t = f
d.x = g
j.p = d
g.w = d
g.t = d
g.z = f
g.o = j
g.q = n
g.r = c
assert g.q.z.o.z.o.v.o.txt == "c"