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

class B:
    def __init__(self, txt: str):
        self.t: F = None
        self.o: F = None
        self.z: G = None
        self.y: C = None
        self.x: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: E = None
        self.x: G = None
        self.p: G = None
        self.o: D = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.s: D = None
        self.x: C = None
        self.txt = txt

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

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

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

class B:
    def __init__(self, txt: str):
        self.t: F = None
        self.o: F = None
        self.z: G = None
        self.y: C = None
        self.x: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: E = None
        self.x: G = None
        self.p: G = None
        self.o: D = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.s: D = None
        self.x: C = None
        self.txt = txt

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

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

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