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

class B:
    def __init__(self, txt: str):
        self.t: A = None
        self.s: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.y: A = None
        self.r: C = None
        self.u: F = None
        self.q: E = None
        self.txt = txt

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

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

j = A("j")
b = B("b")
m = C("m")
h = D("h")
e = E("e")
n = F("n")
k = B("k")
l = A("l")
g = F("g")
f = E("f")

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

class B:
    def __init__(self, txt: str):
        self.t: A = None
        self.s: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.y: A = None
        self.r: C = None
        self.u: F = None
        self.q: E = None
        self.txt = txt

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

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

j = A("j")
b = B("b")
m = C("m")
h = D("h")
e = E("e")
n = F("n")
k = B("k")
l = A("l")
g = F("g")
f = E("f")

j.w = l
j.y = n
j.v = g
j.q = h
b.t = l
b.s = m
m.w = l
h.y = j
h.r = m
h.u = n
h.q = f
e.q = m
e.r = m
e.z = k
e.x = b
n.r = e
k.t = j
k.s = m
l.w = j
l.y = g
l.v = n
l.q = h
g.r = f
f.q = m
f.r = m
f.z = b
f.x = k
assert k.s.w.v.r.z.s.w.q.y.v.txt == "g"