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

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

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

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

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

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

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

a = A("a")
f = B("f")
i = C("i")
c = D("c")
g = E("g")
h = F("h")
m = G("m")
k = D("k")

a.v = i
a.u = m
f.q = a
f.p = g
f.y = i
i.y = h
c.p = i
c.q = k
c.y = a
g.s = h
h.q = f
h.v = f
h.w = a
h.p = i
h.s = g
m.s = h
m.x = a
k.p = i
k.q = c
k.y = a
assert a.v.y.s.txt == "
class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.u: G = None
        self.txt = txt

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

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

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

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

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

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

a = A("a")
f = B("f")
i = C("i")
c = D("c")
g = E("g")
h = F("h")
m = G("m")
k = D("k")

a.v = i
a.u = m
f.q = a
f.p = g
f.y = i
i.y = h
c.p = i
c.q = k
c.y = a
g.s = h
h.q = f
h.v = f
h.w = a
h.p = i
h.s = g
m.s = h
m.x = a
k.p = i
k.q = c
k.y = a
assert a.v.y.s.txt == "g"