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

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

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

class D:
    def __init__(self, txt: str):
        self.r: C = None
        self.o: F = None
        self.x: A = None
        self.y: B = None
        self.v: F = None
        self.p: B = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.w: C = None
        self.txt = txt

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.r: C = None
        self.o: F = None
        self.x: A = None
        self.y: B = None
        self.v: F = None
        self.p: B = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.w: C = None
        self.txt = txt

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

f.q = k
f.v = i
f.o = g
b.x = i
i.w = n
d.r = i
d.o = m
d.v = m
d.x = k
d.y = b
d.p = b
c.p = n
m.s = i
m.u = n
g.w = i
n.q = f
n.v = l
n.o = g
l.w = n
k.q = f
k.v = i
k.o = g
assert i.w.o.w.w.txt == "n"