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

class B:
    def __init__(self, txt: str):
        self.x: F = None
        self.z: C = None
        self.q: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.p: D = None
        self.o: G = None
        self.x: A = None
        self.z: E = None
        self.q: B = None
        self.w: F = None
        self.t: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.y: G = None
        self.q: B = None
        self.t: F = None
        self.txt = txt

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.x: F = None
        self.z: C = None
        self.q: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.p: D = None
        self.o: G = None
        self.x: A = None
        self.z: E = None
        self.q: B = None
        self.w: F = None
        self.t: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.y: G = None
        self.q: B = None
        self.t: F = None
        self.txt = txt

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

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

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

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

c.y = m
g.x = f
g.z = m
g.q = c
m.p = i
m.o = a
m.x = c
m.z = n
m.q = g
m.w = f
m.t = d
i.y = a
i.q = d
i.t = f
b.q = m
b.t = i
b.v = f
f.t = a
f.v = c
f.w = i
a.q = n
a.p = f
a.w = g
l.q = m
l.t = i
l.v = f
n.q = m
n.t = i
n.v = f
d.x = f
d.z = m
d.q = c
assert b.v.t.p.txt == "f"