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

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

class C:
    def __init__(self, txt: str):
        self.t: B = None
        self.x: E = None
        self.u: D = None
        self.p: A = None
        self.w: A = None
        self.v: D = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.v: E = None
        self.x: D = None
        self.w: E = None
        self.r: C = None
        self.u: E = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.v: C = None
        self.w: D = None
        self.p: F = None
        self.z: E = None
        self.txt = txt

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

i.w = l
i.x = j
i.q = f
j.q = l
j.z = g
j.s = d
d.t = j
d.x = l
d.u = k
d.v = k
d.p = i
d.w = i
k.o = l
k.s = d
l.v = h
l.r = h
l.s = h
l.t = f
g.v = l
g.w = l
g.u = l
g.x = k
g.r = d
h.v = d
h.w = k
h.p = g
h.z = l
f.o = l
f.s = d
assert h.z.r.v.txt == "
class A:
    def __init__(self, txt: str):
        self.w: E = None
        self.x: B = None
        self.q: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.t: B = None
        self.x: E = None
        self.u: D = None
        self.p: A = None
        self.w: A = None
        self.v: D = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.v: E = None
        self.x: D = None
        self.w: E = None
        self.r: C = None
        self.u: E = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.v: C = None
        self.w: D = None
        self.p: F = None
        self.z: E = None
        self.txt = txt

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

i.w = l
i.x = j
i.q = f
j.q = l
j.z = g
j.s = d
d.t = j
d.x = l
d.u = k
d.v = k
d.p = i
d.w = i
k.o = l
k.s = d
l.v = h
l.r = h
l.s = h
l.t = f
g.v = l
g.w = l
g.u = l
g.x = k
g.r = d
h.v = d
h.w = k
h.p = g
h.z = l
f.o = l
f.s = d
assert h.z.r.v.txt == "d"