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

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.z: G = None
        self.t: D = None
        self.v: B = None
        self.o: C = None
        self.txt = txt

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

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

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.z: G = None
        self.t: D = None
        self.v: B = None
        self.o: C = None
        self.txt = txt

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

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