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

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

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

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

class E:
    def __init__(self, txt: str):
        self.p: G = None
        self.u: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.w: B = None
        self.r: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.p: A = None
        self.o: E = None
        self.x: A = None
        self.t: B = None
        self.r: B = None
        self.txt = txt

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.p: G = None
        self.u: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.w: B = None
        self.r: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.p: A = None
        self.o: E = None
        self.x: A = None
        self.t: B = None
        self.r: B = None
        self.txt = txt

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

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