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

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

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

class D:
    def __init__(self, txt: str):
        self.q: B = None
        self.w: A = None
        self.x: G = None
        self.u: B = None
        self.o: F = None
        self.s: F = None
        self.z: F = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.q: C = None
        self.o: A = None
        self.w: A = None
        self.z: E = None
        self.p: E = None
        self.u: C = None
        self.y: A = None
        self.txt = txt

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

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.q: B = None
        self.w: A = None
        self.x: G = None
        self.u: B = None
        self.o: F = None
        self.s: F = None
        self.z: F = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.q: C = None
        self.o: A = None
        self.w: A = None
        self.z: E = None
        self.p: E = None
        self.u: C = None
        self.y: A = None
        self.txt = txt

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

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

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