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

class B:
    def __init__(self, txt: str):
        self.w: E = None
        self.z: A = None
        self.r: C = None
        self.o: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.p: F = None
        self.y: E = None
        self.t: B = None
        self.o: E = None
        self.txt = txt

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

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

l = A("l")
m = B("m")
a = C("a")
k = D("k")
e = E("e")
g = F("g")
i = A("i")
j = A("j")
f = D("f")
h = F("h")

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

class B:
    def __init__(self, txt: str):
        self.w: E = None
        self.z: A = None
        self.r: C = None
        self.o: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.p: F = None
        self.y: E = None
        self.t: B = None
        self.o: E = None
        self.txt = txt

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

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

l = A("l")
m = B("m")
a = C("a")
k = D("k")
e = E("e")
g = F("g")
i = A("i")
j = A("j")
f = D("f")
h = F("h")

l.v = m
m.w = e
m.z = l
m.r = a
m.o = a
a.v = l
k.p = h
k.y = e
k.o = e
k.t = m
e.w = m
g.o = h
i.v = m
j.v = m
f.p = g
f.y = e
f.o = e
f.t = m
h.o = g
assert f.p.o.o.o.o.o.o.o.o.o.txt == "h"