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

class B:
    def __init__(self, txt: str):
        self.t: E = None
        self.y: C = None
        self.p: E = None
        self.txt = txt

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

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

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.t: E = None
        self.y: C = None
        self.p: E = None
        self.txt = txt

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

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

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

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

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

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

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