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

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: F = None
        self.o: C = None
        self.s: A = None
        self.z: B = None
        self.r: G = None
        self.t: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.r: C = None
        self.w: A = None
        self.q: F = None
        self.txt = txt

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

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: F = None
        self.o: C = None
        self.s: A = None
        self.z: B = None
        self.r: G = None
        self.t: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.r: C = None
        self.w: A = None
        self.q: F = None
        self.txt = txt

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

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

f.y = a
f.t = a
f.x = d
m.u = k
m.q = g
m.y = h
g.z = f
l.q = h
l.o = m
l.p = k
l.x = a
k.w = a
k.o = g
k.s = f
k.t = f
k.z = m
k.r = h
a.r = g
a.w = f
a.q = d
h.x = g
d.r = g
d.w = f
d.q = a
assert a.w.x.q.w.x.w.t.txt == "a"