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

class B:
    def __init__(self, txt: str):
        self.w: C = None
        self.q: G = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.y: D = None
        self.r: G = None
        self.x: C = None
        self.s: F = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.x: E = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.w: C = None
        self.q: G = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.y: D = None
        self.r: G = None
        self.x: C = None
        self.s: F = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.x: E = None
        self.txt = txt

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

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