class A:
    def __init__(self, txt: str):
        self.r: F = None
        self.y: F = None
        self.t: B = None
        self.x: D = None
        self.z: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: D = None
        self.txt = txt

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

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

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

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

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

class H:
    def __init__(self, txt: str):
        self.s: E = None
        self.p: C = None
        self.r: E = None
        self.v: G = None
        self.q: G = None
        self.u: C = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.x: D = None
        self.txt = txt

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

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

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

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

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

class H:
    def __init__(self, txt: str):
        self.s: E = None
        self.p: C = None
        self.r: E = None
        self.v: G = None
        self.q: G = None
        self.u: C = None
        self.txt = txt

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

k.r = l
k.y = l
k.t = d
k.x = m
k.z = m
d.x = m
c.r = m
c.q = i
c.y = d
m.x = c
m.z = h
m.v = g
m.q = k
i.w = g
l.v = k
g.s = k
g.p = k
g.q = k
g.x = l
h.s = i
h.r = i
h.p = c
h.u = c
h.v = g
h.q = g
assert d.x.x.r.q.y.v.r.txt == "l"