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

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

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

class D:
    def __init__(self, txt: str):
        self.u: D = None
        self.w: B = None
        self.p: A = None
        self.s: F = None
        self.txt = txt

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

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

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

a.w = l
n.q = h
n.r = h
n.v = b
n.w = a
m.q = g
m.u = g
c.u = g
c.w = n
c.p = a
c.s = h
i.q = g
i.y = a
i.w = n
h.v = b
l.q = h
l.r = h
l.v = i
l.w = a
g.u = c
g.w = n
g.p = a
g.s = h
b.q = c
b.y = a
b.w = l
assert i.w.q.v.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.u: D = None
        self.w: B = None
        self.p: A = None
        self.s: F = None
        self.txt = txt

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

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

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

a.w = l
n.q = h
n.r = h
n.v = b
n.w = a
m.q = g
m.u = g
c.u = g
c.w = n
c.p = a
c.s = h
i.q = g
i.y = a
i.w = n
h.v = b
l.q = h
l.r = h
l.v = i
l.w = a
g.u = c
g.w = n
g.p = a
g.s = h
b.q = c
b.y = a
b.w = l
assert i.w.q.v.txt == "b"