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

class B:
    def __init__(self, txt: str):
        self.z: G = None
        self.p: D = None
        self.o: F = None
        self.q: E = None
        self.w: F = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.y: G = None
        self.w: F = None
        self.q: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: G = None
        self.w: B = None
        self.r: F = None
        self.y: B = None
        self.t: D = None
        self.v: F = None
        self.txt = txt

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.z: G = None
        self.p: D = None
        self.o: F = None
        self.q: E = None
        self.w: F = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.y: G = None
        self.w: F = None
        self.q: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: G = None
        self.w: B = None
        self.r: F = None
        self.y: B = None
        self.t: D = None
        self.v: F = None
        self.txt = txt

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

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

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

j.p = k
b.z = d
b.p = f
b.o = k
b.w = k
b.q = a
h.p = k
h.v = k
h.q = g
f.y = d
f.w = k
f.q = g
g.p = d
g.w = b
g.y = b
g.r = k
g.v = k
g.t = f
k.o = j
k.z = h
k.s = h
k.x = d
d.t = f
d.u = k
a.p = d
a.w = b
a.y = b
a.r = k
a.v = k
a.t = f
assert b.q.p.u.x.t.y.u.x.txt == "d"