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

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

class C:
    def __init__(self, txt: str):
        self.v: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.q: A = None
        self.x: D = None
        self.s: D = None
        self.p: D = None
        self.t: E = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.s: A = None
        self.v: D = None
        self.p: D = None
        self.z: C = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.v: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.q: A = None
        self.x: D = None
        self.s: D = None
        self.p: D = None
        self.t: E = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.s: A = None
        self.v: D = None
        self.p: D = None
        self.z: C = None
        self.txt = txt

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

f.r = i
f.z = h
f.t = n
f.q = g
k.w = f
g.v = b
j.q = f
j.x = n
j.s = n
j.p = n
j.t = m
h.r = i
b.s = f
b.v = n
b.p = n
b.z = g
m.r = k
n.q = f
n.x = j
n.s = j
n.p = j
n.t = m
i.w = f
assert n.s.t.r.w.txt == "f"