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

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

class C:
    def __init__(self, txt: str):
        self.v: D = None
        self.q: E = None
        self.z: F = None
        self.x: D = None
        self.r: H = None
        self.o: G = None
        self.s: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.o: C = 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.r: D = None
        self.x: A = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.v: A = None
        self.x: F = None
        self.o: A = None
        self.u: B = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.w: E = None
        self.txt = txt

l = A("l")
n = B("n")
d = C("d")
b = D("b")
c = E("c")
e = F("e")
f = G("f")
k = H("k")

l.r = b
l.q = b
n.z = d
d.v = b
d.x = b
d.q = c
d.z = e
d.s = e
d.r = k
d.o = f
b.o = d
c.r = n
e.r = b
e.x = l
f.v = l
f.o = l
f.x = e
f.u = n
k.w = c
assert b.o.r.w.r.txt == "
class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.q: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.v: D = None
        self.q: E = None
        self.z: F = None
        self.x: D = None
        self.r: H = None
        self.o: G = None
        self.s: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.o: C = 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.r: D = None
        self.x: A = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.v: A = None
        self.x: F = None
        self.o: A = None
        self.u: B = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.w: E = None
        self.txt = txt

l = A("l")
n = B("n")
d = C("d")
b = D("b")
c = E("c")
e = F("e")
f = G("f")
k = H("k")

l.r = b
l.q = b
n.z = d
d.v = b
d.x = b
d.q = c
d.z = e
d.s = e
d.r = k
d.o = f
b.o = d
c.r = n
e.r = b
e.x = l
f.v = l
f.o = l
f.x = e
f.u = n
k.w = c
assert b.o.r.w.r.txt == "n"