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

class B:
    def __init__(self, txt: str):
        self.u: G = None
        self.v: E = None
        self.t: D = None
        self.q: G = None
        self.r: F = None
        self.txt = txt

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.p: D = None
        self.txt = txt

b = A("b")
h = B("h")
n = C("n")
k = D("k")
g = E("g")
l = F("l")
j = G("j")
d = D("d")

b.w = h
h.u = j
h.q = j
h.v = g
h.t = k
h.r = l
n.r = b
n.t = b
k.z = d
k.w = b
g.y = j
g.v = k
l.z = b
l.w = d
l.p = h
j.p = d
d.z = k
d.w = b
assert g.v.z.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: G = None
        self.v: E = None
        self.t: D = None
        self.q: G = None
        self.r: F = None
        self.txt = txt

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.p: D = None
        self.txt = txt

b = A("b")
h = B("h")
n = C("n")
k = D("k")
g = E("g")
l = F("l")
j = G("j")
d = D("d")

b.w = h
h.u = j
h.q = j
h.v = g
h.t = k
h.r = l
n.r = b
n.t = b
k.z = d
k.w = b
g.y = j
g.v = k
l.z = b
l.w = d
l.p = h
j.p = d
d.z = k
d.w = b
assert g.v.z.w.w.txt == "h"