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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.q: A = None
        self.p: B = None
        self.r: G = None
        self.y: G = None
        self.u: A = None
        self.x: B = None
        self.txt = txt

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

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

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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.q: A = None
        self.p: B = None
        self.r: G = None
        self.y: G = None
        self.u: A = None
        self.x: B = None
        self.txt = txt

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

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

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