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

class B:
    def __init__(self, txt: str):
        self.u: A = None
        self.r: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: D = None
        self.w: B = None
        self.r: F = None
        self.z: B = None
        self.o: D = None
        self.txt = txt

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

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

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

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

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

f = A("f")
j = B("j")
c = C("c")
i = D("i")
b = E("b")
k = F("k")
l = G("l")
m = H("m")

f.r = j
f.o = c
f.t = c
f.x = l
f.u = i
f.y = m
f.s = b
j.u = f
j.r = f
c.y = i
c.o = i
c.w = j
c.z = j
c.r = k
i.u = f
b.t = k
b.w = m
b.o = j
k.w = f
k.t = m
l.r = k
l.o = m
m.x = c
assert m.x.r.w.x.r.t.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.o: C = None
        self.x: G = None
        self.t: C = None
        self.u: D = None
        self.y: H = None
        self.s: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: A = None
        self.r: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: D = None
        self.w: B = None
        self.r: F = None
        self.z: B = None
        self.o: D = None
        self.txt = txt

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

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

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

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

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

f = A("f")
j = B("j")
c = C("c")
i = D("i")
b = E("b")
k = F("k")
l = G("l")
m = H("m")

f.r = j
f.o = c
f.t = c
f.x = l
f.u = i
f.y = m
f.s = b
j.u = f
j.r = f
c.y = i
c.o = i
c.w = j
c.z = j
c.r = k
i.u = f
b.t = k
b.w = m
b.o = j
k.w = f
k.t = m
l.r = k
l.o = m
m.x = c
assert m.x.r.w.x.r.t.txt == "m"