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

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: F = None
        self.s: C = None
        self.r: C = None
        self.u: G = None
        self.z: G = None
        self.y: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.s: C = None
        self.w: E = None
        self.q: C = None
        self.txt = txt

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

h = A("h")
d = B("d")
f = C("f")
j = D("j")
k = E("k")
m = F("m")
i = G("i")
g = B("g")

h.r = g
h.t = k
d.p = g
d.y = g
d.t = f
d.x = h
d.r = i
f.w = d
f.t = m
f.y = i
j.x = m
j.w = m
k.q = m
k.s = f
k.r = f
k.u = i
k.z = i
k.y = j
m.s = f
m.q = f
m.w = k
i.p = m
i.z = f
g.p = d
g.y = d
g.t = f
g.x = h
g.r = i
assert d.r.p.w.z.p.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.t: E = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: F = None
        self.s: C = None
        self.r: C = None
        self.u: G = None
        self.z: G = None
        self.y: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.s: C = None
        self.w: E = None
        self.q: C = None
        self.txt = txt

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

h = A("h")
d = B("d")
f = C("f")
j = D("j")
k = E("k")
m = F("m")
i = G("i")
g = B("g")

h.r = g
h.t = k
d.p = g
d.y = g
d.t = f
d.x = h
d.r = i
f.w = d
f.t = m
f.y = i
j.x = m
j.w = m
k.q = m
k.s = f
k.r = f
k.u = i
k.z = i
k.y = j
m.s = f
m.q = f
m.w = k
i.p = m
i.z = f
g.p = d
g.y = d
g.t = f
g.x = h
g.r = i
assert d.r.p.w.z.p.txt == "m"