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

class B:
    def __init__(self, txt: str):
        self.o: D = None
        self.v: E = None
        self.t: E = None
        self.q: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.t: A = None
        self.o: F = None
        self.s: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.r: F = None
        self.v: B = None
        self.o: D = None
        self.s: D = None
        self.txt = txt

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

a = A("a")
f = B("f")
m = C("m")
e = D("e")
k = E("k")
g = F("g")
b = A("b")

a.z = g
a.w = k
f.o = e
f.v = k
f.t = k
f.q = k
m.x = f
e.t = a
e.s = a
e.o = g
k.r = g
k.v = f
k.o = e
k.s = e
g.w = k
b.z = g
b.w = k
assert g.w.o.o.w.o.txt == "
class A:
    def __init__(self, txt: str):
        self.z: F = None
        self.w: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: D = None
        self.v: E = None
        self.t: E = None
        self.q: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.t: A = None
        self.o: F = None
        self.s: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.r: F = None
        self.v: B = None
        self.o: D = None
        self.s: D = None
        self.txt = txt

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

a = A("a")
f = B("f")
m = C("m")
e = D("e")
k = E("k")
g = F("g")
b = A("b")

a.z = g
a.w = k
f.o = e
f.v = k
f.t = k
f.q = k
m.x = f
e.t = a
e.s = a
e.o = g
k.r = g
k.v = f
k.o = e
k.s = e
g.w = k
b.z = g
b.w = k
assert g.w.o.o.w.o.txt == "e"