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

class B:
    def __init__(self, txt: str):
        self.q: A = None
        self.r: G = None
        self.u: G = None
        self.t: B = None
        self.y: D = None
        self.x: B = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.p: H = None
        self.x: C = None
        self.y: E = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.o: H = None
        self.txt = txt

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

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

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

class B:
    def __init__(self, txt: str):
        self.q: A = None
        self.r: G = None
        self.u: G = None
        self.t: B = None
        self.y: D = None
        self.x: B = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.p: H = None
        self.x: C = None
        self.y: E = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.o: H = None
        self.txt = txt

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

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

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