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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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