class A:
    def __init__(self, txt: str):
        self.o: H = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.q: D = None
        self.t: A = None
        self.x: E = None
        self.y: E = None
        self.v: H = None
        self.z: H = None
        self.w: H = None
        self.p: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.s: A = None
        self.q: F = None
        self.o: C = None
        self.x: A = None
        self.r: G = None
        self.txt = txt

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

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

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

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.q: D = None
        self.t: A = None
        self.x: E = None
        self.y: E = None
        self.v: H = None
        self.z: H = None
        self.w: H = None
        self.p: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.s: A = None
        self.q: F = None
        self.o: C = None
        self.x: A = None
        self.r: G = None
        self.txt = txt

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

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

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

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

f.o = k
b.p = l
i.u = m
j.q = m
j.t = f
j.x = d
j.y = d
j.v = k
j.z = k
j.w = k
j.p = b
d.s = f
d.x = f
d.q = e
d.o = i
d.r = l
e.r = f
l.s = f
l.z = e
k.t = e
m.q = j
m.t = f
m.x = d
m.y = d
m.v = k
m.z = k
m.w = k
m.p = b
assert j.p.p.z.r.txt == "f"