class A:
    def __init__(self, txt: str):
        self.p: F = None
        self.t: D = None
        self.y: B = None
        self.v: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.s: B = None
        self.t: G = None
        self.v: D = None
        self.r: A = None
        self.y: A = None
        self.q: D = None
        self.txt = txt

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

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

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

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

h = A("h")
i = B("i")
l = C("l")
e = D("e")
g = E("g")
b = F("b")
a = G("a")
d = A("d")
k = E("k")

h.p = b
h.t = e
h.y = i
h.v = l
i.p = e
i.q = h
l.s = i
l.t = a
l.v = e
l.q = e
l.r = h
l.y = d
e.v = b
g.w = b
b.s = d
a.t = l
d.p = b
d.t = e
d.y = i
d.v = l
k.w = b
assert k.w.s.t.v.s.y.p.v.txt == "
class A:
    def __init__(self, txt: str):
        self.p: F = None
        self.t: D = None
        self.y: B = None
        self.v: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.s: B = None
        self.t: G = None
        self.v: D = None
        self.r: A = None
        self.y: A = None
        self.q: D = None
        self.txt = txt

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

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

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

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

h = A("h")
i = B("i")
l = C("l")
e = D("e")
g = E("g")
b = F("b")
a = G("a")
d = A("d")
k = E("k")

h.p = b
h.t = e
h.y = i
h.v = l
i.p = e
i.q = h
l.s = i
l.t = a
l.v = e
l.q = e
l.r = h
l.y = d
e.v = b
g.w = b
b.s = d
a.t = l
d.p = b
d.t = e
d.y = i
d.v = l
k.w = b
assert k.w.s.t.v.s.y.p.v.txt == "b"