class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.r: E = None
        self.v: D = None
        self.y: C = None
        self.o: E = None
        self.w: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.p: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.x: C = None
        self.v: F = None
        self.u: F = None
        self.r: C = None
        self.w: F = None
        self.p: C = None
        self.txt = txt

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

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

m = A("m")
n = B("n")
a = C("a")
f = D("f")
c = E("c")
d = F("d")
g = F("g")
j = C("j")
h = E("h")

m.p = f
m.v = f
m.w = f
m.r = c
m.o = c
m.y = a
n.v = f
a.p = n
f.x = a
f.v = d
f.u = g
f.w = g
f.r = j
f.p = j
c.q = m
c.y = g
c.z = n
c.x = j
d.z = g
d.t = g
d.p = m
d.x = m
d.w = n
g.z = d
g.t = d
g.p = m
g.x = m
g.w = n
j.p = n
h.q = m
h.y = g
h.z = n
h.x = a
assert a.p.v.v.w.v.v.t.txt == "
class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.r: E = None
        self.v: D = None
        self.y: C = None
        self.o: E = None
        self.w: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.p: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.x: C = None
        self.v: F = None
        self.u: F = None
        self.r: C = None
        self.w: F = None
        self.p: C = None
        self.txt = txt

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

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

m = A("m")
n = B("n")
a = C("a")
f = D("f")
c = E("c")
d = F("d")
g = F("g")
j = C("j")
h = E("h")

m.p = f
m.v = f
m.w = f
m.r = c
m.o = c
m.y = a
n.v = f
a.p = n
f.x = a
f.v = d
f.u = g
f.w = g
f.r = j
f.p = j
c.q = m
c.y = g
c.z = n
c.x = j
d.z = g
d.t = g
d.p = m
d.x = m
d.w = n
g.z = d
g.t = d
g.p = m
g.x = m
g.w = n
j.p = n
h.q = m
h.y = g
h.z = n
h.x = a
assert a.p.v.v.w.v.v.t.txt == "g"