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

class B:
    def __init__(self, txt: str):
        self.y: A = None
        self.x: G = None
        self.u: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: H = None
        self.t: H = None
        self.y: E = None
        self.x: G = None
        self.z: B = None
        self.q: E = None
        self.w: C = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.t: H = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.y: E = None
        self.s: A = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.u: H = None
        self.x: H = None
        self.txt = txt

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

f = A("f")
e = B("e")
d = C("d")
n = D("n")
h = E("h")
g = F("g")
b = G("b")
j = H("j")
l = C("l")

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

class B:
    def __init__(self, txt: str):
        self.y: A = None
        self.x: G = None
        self.u: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: H = None
        self.t: H = None
        self.y: E = None
        self.x: G = None
        self.z: B = None
        self.q: E = None
        self.w: C = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.t: H = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.y: E = None
        self.s: A = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.u: H = None
        self.x: H = None
        self.txt = txt

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

f = A("f")
e = B("e")
d = C("d")
n = D("n")
h = E("h")
g = F("g")
b = G("b")
j = H("j")
l = C("l")

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