class A:
    def __init__(self, txt: str):
        self.o: E = None
        self.v: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.r: D = None
        self.y: F = None
        self.o: B = None
        self.v: B = None
        self.u: B = None
        self.s: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.p: E = None
        self.q: C = None
        self.w: D = None
        self.r: B = None
        self.x: A = None
        self.s: E = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.v: C = None
        self.txt = txt

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.r: D = None
        self.y: F = None
        self.o: B = None
        self.v: B = None
        self.u: B = None
        self.s: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.p: E = None
        self.q: C = None
        self.w: D = None
        self.r: B = None
        self.x: A = None
        self.s: E = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.v: C = None
        self.txt = txt

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

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