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

class B:
    def __init__(self, txt: str):
        self.y: F = None
        self.u: F = None
        self.p: A = None
        self.t: D = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.t: B = None
        self.v: G = None
        self.u: D = None
        self.w: C = None
        self.p: C = None
        self.txt = txt

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

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

b = A("b")
e = B("e")
d = C("d")
f = D("f")
a = E("a")
m = F("m")
i = G("i")

b.v = d
e.y = m
e.u = m
e.p = b
e.t = f
d.t = a
d.p = b
d.r = b
f.q = a
a.t = e
a.v = i
a.u = f
a.w = d
a.p = d
m.z = i
m.p = i
m.s = f
m.t = f
i.x = b
i.p = e
i.u = e
i.v = a
i.w = m
i.o = f
assert m.p.o.q.txt == "
class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: F = None
        self.u: F = None
        self.p: A = None
        self.t: D = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.t: B = None
        self.v: G = None
        self.u: D = None
        self.w: C = None
        self.p: C = None
        self.txt = txt

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

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

b = A("b")
e = B("e")
d = C("d")
f = D("f")
a = E("a")
m = F("m")
i = G("i")

b.v = d
e.y = m
e.u = m
e.p = b
e.t = f
d.t = a
d.p = b
d.r = b
f.q = a
a.t = e
a.v = i
a.u = f
a.w = d
a.p = d
m.z = i
m.p = i
m.s = f
m.t = f
i.x = b
i.p = e
i.u = e
i.v = a
i.w = m
i.o = f
assert m.p.o.q.txt == "a"