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

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

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

class D:
    def __init__(self, txt: str):
        self.o: H = None
        self.v: G = None
        self.y: H = None
        self.w: B = None
        self.txt = txt

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

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

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

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

l = A("l")
k = B("k")
i = C("i")
m = D("m")
e = E("e")
g = F("g")
h = G("h")
f = H("f")
b = C("b")

l.p = k
k.o = h
k.t = l
i.t = g
m.o = f
m.y = f
m.v = h
m.w = k
e.u = l
e.s = g
g.w = l
h.z = e
h.q = k
f.t = m
f.y = i
f.p = l
b.t = g
assert l.p.t.p.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.o: H = None
        self.v: G = None
        self.y: H = None
        self.w: B = None
        self.txt = txt

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

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

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

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

l = A("l")
k = B("k")
i = C("i")
m = D("m")
e = E("e")
g = F("g")
h = G("h")
f = H("f")
b = C("b")

l.p = k
k.o = h
k.t = l
i.t = g
m.o = f
m.y = f
m.v = h
m.w = k
e.u = l
e.s = g
g.w = l
h.z = e
h.q = k
f.t = m
f.y = i
f.p = l
b.t = g
assert l.p.t.p.txt == "k"