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

class B:
    def __init__(self, txt: str):
        self.o: A = None
        self.z: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.x: D = None
        self.r: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.p: C = None
        self.x: F = None
        self.u: B = None
        self.s: G = None
        self.w: F = None
        self.y: E = None
        self.v: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.p: A = None
        self.o: B = None
        self.u: A = None
        self.txt = txt

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

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

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

class B:
    def __init__(self, txt: str):
        self.o: A = None
        self.z: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.x: D = None
        self.r: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.p: C = None
        self.x: F = None
        self.u: B = None
        self.s: G = None
        self.w: F = None
        self.y: E = None
        self.v: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.p: A = None
        self.o: B = None
        self.u: A = None
        self.txt = txt

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

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

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