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

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

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

class D:
    def __init__(self, txt: str):
        self.q: E = None
        self.y: E = None
        self.x: C = None
        self.txt = txt

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

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

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

g = A("g")
h = B("h")
i = C("i")
n = D("n")
a = E("a")
e = F("e")
f = G("f")
d = B("d")
k = C("k")

g.x = e
h.x = n
h.u = n
h.q = g
h.z = e
h.t = k
i.r = f
i.w = f
i.v = f
i.o = e
n.q = a
n.y = a
n.x = i
a.o = n
a.y = n
a.t = i
a.u = f
a.s = f
a.z = f
a.v = k
e.y = f
e.w = i
f.u = g
d.x = n
d.u = n
d.q = g
d.z = e
d.t = k
k.r = f
k.w = f
k.v = f
k.o = e
assert k.w.u.x.w.w.u.x.y.txt == "
class A:
    def __init__(self, txt: str):
        self.x: F = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.q: E = None
        self.y: E = None
        self.x: C = None
        self.txt = txt

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

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

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

g = A("g")
h = B("h")
i = C("i")
n = D("n")
a = E("a")
e = F("e")
f = G("f")
d = B("d")
k = C("k")

g.x = e
h.x = n
h.u = n
h.q = g
h.z = e
h.t = k
i.r = f
i.w = f
i.v = f
i.o = e
n.q = a
n.y = a
n.x = i
a.o = n
a.y = n
a.t = i
a.u = f
a.s = f
a.z = f
a.v = k
e.y = f
e.w = i
f.u = g
d.x = n
d.u = n
d.q = g
d.z = e
d.t = k
k.r = f
k.w = f
k.v = f
k.o = e
assert k.w.u.x.w.w.u.x.y.txt == "f"