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

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.s: C = None
        self.o: E = None
        self.v: E = None
        self.q: D = None
        self.w: D = None
        self.txt = txt

f = A("f")
k = B("k")
a = C("a")
h = D("h")
m = E("m")
c = F("c")
b = G("b")

f.r = h
f.y = k
k.y = f
a.t = k
a.w = b
h.z = b
h.v = k
h.q = k
h.s = c
h.r = c
h.y = c
h.o = m
m.v = c
m.w = f
m.o = h
c.z = h
c.p = b
c.t = f
c.s = f
b.s = a
b.o = m
b.v = m
b.q = h
b.w = h
assert m.o.z.o.o.v.txt == "
class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.y: B = None
        self.txt = txt

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.s: C = None
        self.o: E = None
        self.v: E = None
        self.q: D = None
        self.w: D = None
        self.txt = txt

f = A("f")
k = B("k")
a = C("a")
h = D("h")
m = E("m")
c = F("c")
b = G("b")

f.r = h
f.y = k
k.y = f
a.t = k
a.w = b
h.z = b
h.v = k
h.q = k
h.s = c
h.r = c
h.y = c
h.o = m
m.v = c
m.w = f
m.o = h
c.z = h
c.p = b
c.t = f
c.s = f
b.s = a
b.o = m
b.v = m
b.q = h
b.w = h
assert m.o.z.o.o.v.txt == "k"