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

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

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

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

class E:
    def __init__(self, txt: str):
        self.y: D = None
        self.r: G = None
        self.p: B = None
        self.q: F = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.q: A = None
        self.o: A = None
        self.r: D = None
        self.txt = txt

f = A("f")
d = B("d")
k = C("k")
n = D("n")
j = E("j")
a = F("a")
l = G("l")

f.w = n
f.y = k
d.z = k
d.v = j
d.t = n
d.p = l
k.u = a
k.s = l
k.w = j
n.t = j
j.y = n
j.r = l
j.p = d
j.q = a
a.w = f
l.q = f
l.o = f
l.r = n
assert k.u.w.w.t.p.v.y.txt == "
class A:
    def __init__(self, txt: str):
        self.w: D = None
        self.y: C = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.y: D = None
        self.r: G = None
        self.p: B = None
        self.q: F = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.q: A = None
        self.o: A = None
        self.r: D = None
        self.txt = txt

f = A("f")
d = B("d")
k = C("k")
n = D("n")
j = E("j")
a = F("a")
l = G("l")

f.w = n
f.y = k
d.z = k
d.v = j
d.t = n
d.p = l
k.u = a
k.s = l
k.w = j
n.t = j
j.y = n
j.r = l
j.p = d
j.q = a
a.w = f
l.q = f
l.o = f
l.r = n
assert k.u.w.w.t.p.v.y.txt == "n"