class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: C = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.y: A = None
        self.p: B = None
        self.x: B = None
        self.q: A = None
        self.z: F = None
        self.r: A = None
        self.s: D = None
        self.txt = txt

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.r: C = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.y: A = None
        self.p: B = None
        self.x: B = None
        self.q: A = None
        self.z: F = None
        self.r: A = None
        self.s: D = None
        self.txt = txt

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

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

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

c.w = n
a.r = n
n.o = g
j.u = n
j.t = g
j.y = c
j.r = c
l.y = c
l.q = c
l.r = c
l.p = a
l.x = d
l.z = f
l.s = j
f.r = g
f.v = g
f.t = l
f.o = l
g.x = c
g.u = n
d.r = n
assert n.o.x.w.o.u.o.txt == "g"