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

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: A = None
        self.t: G = None
        self.y: B = None
        self.w: C = None
        self.r: C = None
        self.s: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.u: G = None
        self.o: G = None
        self.z: C = None
        self.w: D = None
        self.s: A = None
        self.txt = txt

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

e = A("e")
h = B("h")
m = C("m")
d = D("d")
j = E("j")
a = F("a")
c = G("c")

e.q = h
h.y = a
h.w = d
h.p = d
h.z = d
h.s = m
m.y = h
m.z = j
d.u = c
d.p = m
j.q = e
j.t = c
j.y = h
j.w = m
j.r = m
j.s = m
a.u = c
a.o = c
a.z = m
a.w = d
a.s = e
c.z = m
c.u = j
assert j.w.y.y.w.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: A = None
        self.t: G = None
        self.y: B = None
        self.w: C = None
        self.r: C = None
        self.s: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.u: G = None
        self.o: G = None
        self.z: C = None
        self.w: D = None
        self.s: A = None
        self.txt = txt

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

e = A("e")
h = B("h")
m = C("m")
d = D("d")
j = E("j")
a = F("a")
c = G("c")

e.q = h
h.y = a
h.w = d
h.p = d
h.z = d
h.s = m
m.y = h
m.z = j
d.u = c
d.p = m
j.q = e
j.t = c
j.y = h
j.w = m
j.r = m
j.s = m
a.u = c
a.o = c
a.z = m
a.w = d
a.s = e
c.z = m
c.u = j
assert j.w.y.y.w.txt == "d"