class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: A = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.u: F = None
        self.t: B = None
        self.z: B = None
        self.p: G = None
        self.v: A = None
        self.q: F = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.p: G = None
        self.o: D = None
        self.w: G = None
        self.u: G = None
        self.r: G = None
        self.x: B = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.v: A = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.u: F = None
        self.t: B = None
        self.z: B = None
        self.p: G = None
        self.v: A = None
        self.q: F = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.p: G = None
        self.o: D = None
        self.w: G = None
        self.u: G = None
        self.r: G = None
        self.x: B = None
        self.txt = txt

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

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