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

class B:
    def __init__(self, txt: str):
        self.t: A = None
        self.u: A = None
        self.w: C = None
        self.o: F = None
        self.r: E = None
        self.x: A = None
        self.txt = txt

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

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

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

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

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

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

j.w = n
j.t = d
h.t = j
h.u = j
h.x = j
h.w = f
h.o = n
h.r = d
f.u = n
f.r = d
c.w = k
c.s = k
c.y = k
c.r = j
d.o = k
d.q = n
n.t = h
n.r = h
n.w = h
n.o = k
n.z = c
k.p = n
k.z = c
k.x = f
assert d.q.w.r.q.txt == "
class A:
    def __init__(self, txt: str):
        self.w: F = None
        self.t: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: A = None
        self.u: A = None
        self.w: C = None
        self.o: F = None
        self.r: E = None
        self.x: A = None
        self.txt = txt

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

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

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

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

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

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

j.w = n
j.t = d
h.t = j
h.u = j
h.x = j
h.w = f
h.o = n
h.r = d
f.u = n
f.r = d
c.w = k
c.s = k
c.y = k
c.r = j
d.o = k
d.q = n
n.t = h
n.r = h
n.w = h
n.o = k
n.z = c
k.p = n
k.z = c
k.x = f
assert d.q.w.r.q.txt == "n"