class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.s: F = None
        self.y: D = None
        self.w: D = None
        self.x: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: F = None
        self.v: A = None
        self.u: F = None
        self.w: F = None
        self.r: C = None
        self.t: H = None
        self.p: F = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.p: H = None
        self.txt = txt

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.s: F = None
        self.v: A = None
        self.u: F = None
        self.w: F = None
        self.r: C = None
        self.t: H = None
        self.p: F = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.p: H = None
        self.txt = txt

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

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

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

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

h.p = g
h.s = i
h.y = l
h.w = l
h.x = l
a.s = i
a.u = i
a.w = i
a.p = i
a.v = h
a.r = g
a.t = d
g.q = l
g.r = d
l.y = h
l.p = i
e.p = d
i.z = a
n.r = l
d.q = e
d.p = a
assert a.t.p.t.txt == "d"