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

class B:
    def __init__(self, txt: str):
        self.t: A = None
        self.w: C = None
        self.s: F = None
        self.y: F = None
        self.q: G = None
        self.u: A = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.s: C = None
        self.q: G = None
        self.w: B = None
        self.t: A = None
        self.r: C = None
        self.v: B = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.q: F = None
        self.y: B = None
        self.s: C = None
        self.t: A = None
        self.o: B = None
        self.z: A = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.t: A = None
        self.w: C = None
        self.s: F = None
        self.y: F = None
        self.q: G = None
        self.u: A = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.s: C = None
        self.q: G = None
        self.w: B = None
        self.t: A = None
        self.r: C = None
        self.v: B = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.q: F = None
        self.y: B = None
        self.s: C = None
        self.t: A = None
        self.o: B = None
        self.z: A = None
        self.txt = txt

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

c.p = b
c.w = m
c.q = m
c.y = g
g.t = c
g.u = c
g.w = m
g.s = b
g.y = b
g.q = f
m.p = a
m.z = b
m.o = b
m.x = f
m.v = c
n.s = m
n.r = m
n.q = f
n.w = g
n.v = g
n.t = c
a.v = c
b.s = f
f.q = b
f.y = g
f.o = g
f.s = m
f.t = c
f.z = c
assert a.v.w.p.v.w.x.txt == "f"