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

class B:
    def __init__(self, txt: str):
        self.t: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.y: H = None
        self.r: E = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.z: E = None
        self.u: A = None
        self.v: H = None
        self.w: F = None
        self.r: F = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.q: G = None
        self.txt = txt

a = A("a")
g = B("g")
e = C("e")
n = D("n")
h = E("h")
c = F("c")
b = G("b")
k = H("k")
l = C("l")

a.w = n
a.s = n
a.r = h
a.v = c
a.z = g
g.t = h
e.u = l
n.y = k
n.r = h
h.s = k
h.u = l
h.o = n
h.z = g
c.p = g
c.q = k
b.z = h
b.u = a
b.v = k
b.w = c
b.r = c
k.q = b
l.u = e
assert b.w.q.q.r.txt == "
class A:
    def __init__(self, txt: str):
        self.w: D = None
        self.s: D = None
        self.r: E = None
        self.v: F = None
        self.z: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.y: H = None
        self.r: E = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.z: E = None
        self.u: A = None
        self.v: H = None
        self.w: F = None
        self.r: F = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.q: G = None
        self.txt = txt

a = A("a")
g = B("g")
e = C("e")
n = D("n")
h = E("h")
c = F("c")
b = G("b")
k = H("k")
l = C("l")

a.w = n
a.s = n
a.r = h
a.v = c
a.z = g
g.t = h
e.u = l
n.y = k
n.r = h
h.s = k
h.u = l
h.o = n
h.z = g
c.p = g
c.q = k
b.z = h
b.u = a
b.v = k
b.w = c
b.r = c
k.q = b
l.u = e
assert b.w.q.q.r.txt == "c"