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

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.o: D = None
        self.s: A = None
        self.z: C = None
        self.p: A = None
        self.r: F = None
        self.t: E = None
        self.txt = txt

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

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

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.o: D = None
        self.s: A = None
        self.z: C = None
        self.p: A = None
        self.r: F = None
        self.t: E = None
        self.txt = txt

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

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