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

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

class C:
    def __init__(self, txt: str):
        self.r: D = None
        self.q: G = None
        self.v: H = None
        self.t: A = None
        self.o: G = None
        self.p: G = None
        self.z: A = None
        self.x: D = None
        self.txt = txt

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

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

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

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

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

n = A("n")
k = B("k")
c = C("c")
d = D("d")
g = E("g")
i = F("i")
e = G("e")
h = H("h")

n.t = e
n.p = i
k.q = i
k.w = g
k.z = d
c.r = d
c.x = d
c.q = e
c.o = e
c.p = e
c.v = h
c.t = n
c.z = n
d.r = h
g.s = i
g.z = d
i.t = d
e.o = i
h.q = i
h.s = e
h.w = n
assert d.r.q.t.r.w.p.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: G = None
        self.p: F = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.r: D = None
        self.q: G = None
        self.v: H = None
        self.t: A = None
        self.o: G = None
        self.p: G = None
        self.z: A = None
        self.x: D = None
        self.txt = txt

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

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

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

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

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

n = A("n")
k = B("k")
c = C("c")
d = D("d")
g = E("g")
i = F("i")
e = G("e")
h = H("h")

n.t = e
n.p = i
k.q = i
k.w = g
k.z = d
c.r = d
c.x = d
c.q = e
c.o = e
c.p = e
c.v = h
c.t = n
c.z = n
d.r = h
g.s = i
g.z = d
i.t = d
e.o = i
h.q = i
h.s = e
h.w = n
assert d.r.q.t.r.w.p.t.txt == "d"