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

class B:
    def __init__(self, txt: str):
        self.x: H = None
        self.r: G = None
        self.t: H = None
        self.s: D = None
        self.w: H = None
        self.u: A = None
        self.p: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.x: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.q: E = None
        self.o: G = None
        self.v: F = None
        self.y: F = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.v: B = None
        self.p: B = None
        self.x: E = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.o: E = None
        self.v: D = None
        self.q: H = None
        self.p: H = None
        self.txt = txt

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

k = A("k")
c = B("c")
d = C("d")
m = D("m")
b = E("b")
e = F("e")
n = G("n")
a = H("a")

k.y = c
k.w = m
k.u = e
c.x = a
c.t = a
c.w = a
c.r = n
c.s = m
c.u = k
c.p = b
d.x = b
m.q = b
m.o = n
m.v = e
m.y = e
b.u = n
e.v = c
e.p = c
e.x = b
n.o = b
n.v = m
n.q = a
n.p = a
a.z = e
assert k.y.r.o.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.w: D = None
        self.u: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: H = None
        self.r: G = None
        self.t: H = None
        self.s: D = None
        self.w: H = None
        self.u: A = None
        self.p: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.x: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.q: E = None
        self.o: G = None
        self.v: F = None
        self.y: F = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.v: B = None
        self.p: B = None
        self.x: E = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.o: E = None
        self.v: D = None
        self.q: H = None
        self.p: H = None
        self.txt = txt

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

k = A("k")
c = B("c")
d = C("d")
m = D("m")
b = E("b")
e = F("e")
n = G("n")
a = H("a")

k.y = c
k.w = m
k.u = e
c.x = a
c.t = a
c.w = a
c.r = n
c.s = m
c.u = k
c.p = b
d.x = b
m.q = b
m.o = n
m.v = e
m.y = e
b.u = n
e.v = c
e.p = c
e.x = b
n.o = b
n.v = m
n.q = a
n.p = a
a.z = e
assert k.y.r.o.txt == "b"