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

class B:
    def __init__(self, txt: str):
        self.v: F = None
        self.y: E = None
        self.q: D = None
        self.z: C = None
        self.u: C = None
        self.t: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.x: B = None
        self.q: A = None
        self.v: G = None
        self.o: F = None
        self.s: B = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.x: F = None
        self.q: B = None
        self.o: F = None
        self.s: B = None
        self.w: E = None
        self.v: C = None
        self.u: B = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.v: F = None
        self.y: E = None
        self.q: D = None
        self.z: C = None
        self.u: C = None
        self.t: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.x: B = None
        self.q: A = None
        self.v: G = None
        self.o: F = None
        self.s: B = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.x: F = None
        self.q: B = None
        self.o: F = None
        self.s: B = None
        self.w: E = None
        self.v: C = None
        self.u: B = None
        self.txt = txt

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

g.z = m
f.v = h
f.t = h
f.y = d
f.q = l
f.z = m
f.u = m
m.x = f
m.s = f
m.q = g
m.v = n
m.o = h
l.q = m
l.u = g
l.y = h
d.u = f
h.z = l
n.x = h
n.o = h
n.q = f
n.s = f
n.u = f
n.w = d
n.v = m
b.z = m
assert l.q.o.z.q.x.y.u.txt == "f"