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

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

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

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

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

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

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

l = A("l")
c = B("c")
n = C("n")
a = D("a")
i = E("i")
j = F("j")
d = G("d")
h = G("h")

l.w = n
l.r = h
l.z = j
c.t = j
n.z = l
n.v = i
n.w = h
a.w = d
a.y = i
i.r = a
j.q = l
j.t = l
j.x = d
j.u = i
d.w = c
d.p = l
d.r = a
h.w = c
h.p = l
h.r = a
assert l.z.t.z.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.r: G = None
        self.z: F = None
        self.txt = txt

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

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

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

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

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

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

l = A("l")
c = B("c")
n = C("n")
a = D("a")
i = E("i")
j = F("j")
d = G("d")
h = G("h")

l.w = n
l.r = h
l.z = j
c.t = j
n.z = l
n.v = i
n.w = h
a.w = d
a.y = i
i.r = a
j.q = l
j.t = l
j.x = d
j.u = i
d.w = c
d.p = l
d.r = a
h.w = c
h.p = l
h.r = a
assert l.z.t.z.txt == "j"