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

class B:
    def __init__(self, txt: str):
        self.r: D = None
        self.s: C = None
        self.z: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.p: F = None
        self.w: D = None
        self.txt = txt

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

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

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

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

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

g.q = l
g.u = h
k.r = f
k.s = e
k.z = h
e.p = m
e.w = f
f.z = h
f.v = h
f.s = g
h.w = e
h.o = e
m.w = h
m.q = l
m.r = k
l.w = h
c.p = m
c.w = f
assert l.w.w.p.q.w.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.q: G = None
        self.u: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: D = None
        self.s: C = None
        self.z: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.p: F = None
        self.w: D = None
        self.txt = txt

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

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

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

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

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

g.q = l
g.u = h
k.r = f
k.s = e
k.z = h
e.p = m
e.w = f
f.z = h
f.v = h
f.s = g
h.w = e
h.o = e
m.w = h
m.q = l
m.r = k
l.w = h
c.p = m
c.w = f
assert l.w.w.p.q.w.w.w.txt == "f"