class A:
    def __init__(self, txt: str):
        self.q: G = None
        self.p: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: A = None
        self.w: C = None
        self.z: C = None
        self.p: E = None
        self.s: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.z: E = None
        self.r: D = None
        self.txt = txt

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

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.u: A = None
        self.w: C = None
        self.z: C = None
        self.p: E = None
        self.s: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.z: E = None
        self.r: D = None
        self.txt = txt

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

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

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

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

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

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